US officials and Taliban representatives have signed an agreement after months of negotiations in Qatar’s capital that is aimed at ending the United States’s longest war, fought in Afghanistan since 2001.

Saturday’s agreement, signed in Doha in the presence of leaders from Pakistan, Qatar, Turkey, India, Indonesia, Uzbekistan and Tajikistan, will pave the way for the US to gradually withdraw its troops.

The two sides have long wrangled over the US demand for a ceasefire before the signing of the agreement, which has four points: a timeline of 14 months for the withdrawal of all US and NATO troops from Afghanistan; a Taliban guarantee that Afghan soil will not be used as a launchpad that would threaten the security of the US; the launch of intra-Afghan negotiations by March 10; and a permanent and comprehensive ceasefire.

In a statement, the Taliban said it had reached an agreement “about the termination of occupation of Afghanistan”.

“The accord about the complete withdrawal of all foreign forces from Afghanistan and never intervening in its affairs in the future is undoubtedly a great achievement,” it added.

Earlier on Saturday, the Taliban ordered all its fighters to halt fighting and “refrain from attacks”.

Mohammed Naeem, a Taliban representative in Doha, described the agreement as “a step forward”.

“With this deal comes the end of war in Afghanistan,” he told Al Jazeera.

For his part, US Secretary of State Mike Pompeo called on the Taliban to honour its commitments.

“I know there will be a temptation to declare victory, but victory for Afghans will only be achieved when they can live in peace and prosper,” he said at the Doha ceremony.

Minutes before the agreement was signed, a joint statement released by the US and the Afghan government said the US and NATO troops would withdraw from Afghanistan within 14 months.

About 14,000 US troops and approximately 17,000 troops from 39 NATO allies and partner countries are stationed in Afghanistan in a non-combatant role.

(Source: Agency)