The US and the Taliban have signed a landmark peace agreement after nearly 20 years of war that could result in American troops leaving Afghanistan within 14 months.

The deal also paves the way for talks between Afghans to end one of the longest-running conflicts in the world.

Coronavirus in a war zone: Afghanistan braces for outbreak after first case Read more

At a signing ceremony in Doha on Saturday, US secretary of state Mike Pompeo and Taliban deputy leader Mullah Baradar took turns to address a crowd of senior dignitaries. Although the deal was signed by the US peace envoy Zalmay Khalilzad, it was the first time a US cabinet member had met members of the insurgency.

The Taliban have agreed to sever ties with al-Qaida and other international terror groups and sit down for peace talks with other Afghans, including a government they have always denounced as a US puppet. In return, Washington will start a phased withdrawal of troops.

Troop levels will be cut to 8,600 over the next 135 days and five bases will be closed. If both sides keep to their commitments, all US military forces could leave Afghanistan by spring 2021, although Washington is thought to want to keep intelligence operatives on the ground fighting Isis and al-Qaida.

The deal also promises work on a prisoner exchange ahead of Afghan talks due to start on 10 March, with the release of 5,000 Taliban prisoners in return for the insurgents freeing 1,000 government soldiers.

But Kabul, which holds the Taliban fighters, is not party to the agreement and it is unclear if it will be willing to release so many enemy combatants onto an active battlefield. The Afghan president, Ashraf Ghani, has not commented on the plans.

The long-term enemies sealed the pact in front of a sign declaring “Agreement for Bringing Peace to Afghanistan”, after a week of “violence reduction”. The near-ceasefire was meant to demonstrate the militants’ ability to control their foot soldiers, but also gave the country a rare taste of something like peace.

Civil war – in various iterations – has torn Afghanistan apart over 40 years. With the majority of the population under 30, most have known nothing but conflict. So there is excitement that efforts to negotiate an end to the war have made progress.

But there is also widespread concern about Taliban motives in signing a deal they have described as a “victory”, and fears the US may use the deal as cover to leave regardless of the state of the war. No Afghans apart from the militants have been part of talks so far.

“Like many Afghans, I have mixed feelings. The general secrecy around the deal, the lack of presence of non-Taliban Afghans in the process, the fact that the US-Taliban talks seemed to marginalise other Afghan voices, all have made me anxious,” said Shaharzad Akbar, the chair of the Afghanistan Independent Human Rights Commission.

“However, on the other hand, if the agreement allows for a reasonable timeline for a responsible withdrawal and ensures intra-Afghan talks, there is room for hope about a substantive reduction in conflict and violence. Peace will require much more.”

The Taliban have been describing the deal as a victory on social media, and reportedly told their soldiers it is just a tactical pact they can break at will, citing religious precedent.

“There are warning signs. Some of the Taliban social media accounts are quite jubilant about this ‘win’, as they see it,” said Kate Clark, co-director of the Afghanistan Analysts Network. “One of the things that makes me worried is that if the Taliban leadership were serious about negotiations, you would expect them to be preparing the troops for a different stage in ‘the struggle’, and that doesn’t seem to be happening at all.”

US officials were at pains to credit Donald Trump as the president gears up his re-election campaign. US critics suggested last-minute concessions were made in order for Trump to boast about a foreign policy achievement.

“Two weeks ago in Munich, [Mike Pompeo] made a commitment to me and other members of Congress: the Afghan peace deal would NOT require the Afghan [government] to release Taliban prisoners. Today’s deal requires them to release 5,000,” the Democratic congressman Tom Malinowski wrote on Twitter.

In an apparent effort to allay concerns that the Doha deal is more cover for a US withdrawal than first step towards peace, the US defense secretary, Mark Esper, and the Nato secretary general, Jens Stoltenberg, flew to Kabul for a parallel ceremony with the Afghan government.

Ghani and the chief executive, Abdullah Abdullah, currently locked in a bitter dispute about who won last year’s presidential election, sat together on a platform.

This confusion about who is running the country is one of several key concerns overshadowing planned peace talks among Afghan factions, where any political settlement will be hashed out.

A joint statement from the US and Afghan governments promised that without an Afghan peace deal, the US troop withdrawal would not be completed. The Taliban agreement promised that the “date and modalities for a permanent ceasefire” would be announced along with a “future political roadmap of Afghanistan”.

Britain is strongly supportive of the “potentially transformative” US deal, despite the deaths of 454 soldiers fighting the Taliban. It is expected to withdraw 200 of its own 1,100 forces in Afghanistan.

Around Afghanistan there was a mixture of cynicism and enthusiasm.

“I support this deal and everything that brings peace, but I am sure this is not a deal for peace; the Americans have sold the government to the Taliban,” said 25-year-old Mohammad Naser, a computer repairman.

But Shahram, 29, a soldier on guard outside the governor’s office in the western city of Herat, said the deal brought new hope. “Over the last seven days I did not go to war, I was not asked to go and kill people but to stay here and guard them and I am happy about it. I wish for peace, I am optimistic.”