Kabul: The United States would pull 5,400 troops from Afghanistan within 135 days of signing an agreement with the Taliban, the American special envoy told Afghan leaders on Monday.

That pullout would be the start of what is expected to be the gradual withdrawal of all 14,000 US troops that could end America’s longest running war.

The American envoy, Zalmay Khalilzad, who has led nearly a year of talks with the Taliban, told an Afghan news channel in Kabul that the United States had reached an agreement “in principle” with the Afghan insurgents, but he cautioned that final approval rested with President Donald Trump.

“In principle, on paper, yes we have reached an agreement — that it is done,” Khalilzad told the Afghan channel ToloNews. “But it is not final until the president of the United States also agrees to it.”

Afghan leaders aware of Khalilzad’s discussions in Kabul said the most likely sticking point for Trump would be the timeline under which the rest of the American troops would leave.

Khalilzad has not shared those details, but Western officials have previously suggested the timeline for the full withdrawal of American troops would probably be 16 months, if the Taliban meet certain conditions.

In a sign of the escalating violence in Afghanistan amid the US optimism for an imminent deal, a massive explosion shook Kabul just as Khalilzad’s interview with the channel was winding down.

Initial information from police suggested a truck bomb had exploded near Green Village, a large compound providing housing to foreign contractors and nongovernment organisations. The blast was large enough to be heard across the city. Details on casualties were still not clear, but initial government information suggested the death toll could be 30 or more, with 100 wounded. The Taliban claimed responsibility.

The deal with the Taliban is intended to immediately reduce violence in several provinces where the American troops would start to leave, though the exact nature of that reduction — whether it would essentially be an expanded ceasefire — was not clear. Khalilzad is also said to have told Afghan leaders that, as part of the agreement, the United States would reserve the right to assist Afghan forces should they be attacked by the Taliban.

The details on the timing of the first US withdrawal are the first concrete elements of the tightly guarded agreement with the Taliban to emerge publicly.

The initial troop withdrawal would mean the closing of five military bases or the transfer of those bases to the Afghan government.

A deal with the Taliban, if announced, could be the beginning of an end to the nearly two decades of US military presence in Afghanistan, which began with the attacks in the United States on September 11, 2001. The war has cost the lives of tens of thousands of Afghans and more than 3,500 American and coalition soldiers.

But a deal between the Taliban and the United States is only a first step of what will remain a complicated peace process, opening the path for the insurgents to negotiate the political future of the country with other Afghans.

Khalilzad, who arrived in Kabul on Sunday after marathon talks with the insurgents in Qatar, has provided full details on the agreement to President Ashraf Gani, according to the president’s spokesman, Sediq Sediqqi. The Afghan president has been sceptical of the talks with the Taliban, which have so far excluded his government.

Sediqqi said at a news conference Monday that the American envoy had met twice with Gani since arriving in Kabul over the weekend. The Afghan president had asked for time to study the US agreement.

Afghan officials said Gani was provided a copy of the agreement to read in their presence, but the American officials collected it before the start of a larger meeting with other officials.

As American diplomats and Taliban officials have neared a deal in their negotiations, violence has intensified in Afghanistan. The Taliban have launched assaults on two northern Afghan cities in two days, which to security officials seemed a clear attempt to increase Taliban leverage at the negotiating table.

On Saturday, Afghan forces repelled a Taliban assault on the city of Kunduz. The next morning, the Taliban came for Pul e Khumri, a nearby city, where fighting continued on the city edges Monday.

The recent escalation in fighting has caused a large number of civilian casualties. In one air strike in the Girziwan district of northern Faryab province Sunday, local officials said at least 12 civilians, nine of them women and children, were killed.