Image copyright Reuters Image caption President Ashraf Ghani (pictured) was briefed on the US-Taliban deal on Monday

The United States would withdraw 5,400 troops from Afghanistan within 20 weeks as part of a deal "in principle" with Taliban militants, Washington's top negotiator has said.

Zalmay Khalilzad revealed details of the long-awaited deal for the first time in a TV interview after briefing Afghan leaders on the agreement.

But he said final approval still rested with US President Donald Trump.

A huge blast rocked Kabul as the interview aired.

The Taliban said it was behind the attack, which used a bomb strapped to a tractor to kill at least 16 people and injure at least another 119.

The target was a residential compound housing foreigners, just outside the city's heavily-fortified Green Zone.

However, it was Afghan civilians who paid the highest price. By morning, about 400 foreigners had been escorted out of the area as anger bubbled over onto the streets. Locals set fire to tyres and blocked a main road, demanding foreigners leave the area for good.

"This is not the first time we suffer because of them," resident Abdul Jamil told news agency AFP. "We don't want them here any more."

The attack - the third in as many days - highlights fears that US negotiations with the Taliban won't end the daily violence in Afghanistan and its terrible toll on civilians.

The militants now control more territory than at any time since the 2001 US invasion and have so far refused to talk to the Afghan government, whom they deride as American puppets.

Ejaz Malikzada, a researcher at the Afghan Institute for Strategic Studies in Kabul, told the BBC he had little hope of change.

"As far as the Taliban are concerned: we can hear them in Doha, we can hear them in Facebook, we can hear them in media, they have not changed, they will keep bombing," Mr Malikzada said.

"They say: 'we'll fight even if we sign an agreement with the Americans we'll keep fighting and we'll kill, no matter what'. So the Taliban have not changed, the only change that I can see is their bombs have got bigger."

Image copyright Reuters Image caption Protesters took to the streets after the Taliban attack

The deal outlined by Mr Khalilzad in an interview with Tolo News is the product of nine rounds of peace talks that have been held in the Gulf state of Qatar.

In exchange for the US troop withdrawal, the Taliban would ensure that Afghanistan would never again be used as a base for militant groups seeking to attack the US and its allies.

"We have agreed that if the conditions proceed according to the agreement, we will leave within 135 days five bases in which we are present now," Mr Khalilzad said.

Media playback is unsupported on your device Media caption The view from Lashkar Gah province on whether peace with the Taliban is possible

The US currently has about 14,000 troops in the country.

A Taliban spokesman confirmed in a text message to the BBC that the details of the troop withdrawal as outlined by Mr Khalilzad were correct.

A pullout of the remaining forces would depend on conditions, including the start of peace talks between the Afghan government and the Taliban as well as a ceasefire, reports the BBC's Lyse Doucet from Kabul.

Afghan President Ashraf Ghani will study the deal before giving any opinion, his spokesman Sediq Sediqqi said earlier on Monday. He said the government still needed proof the Taliban were committed to peace.

Media playback is unsupported on your device Media caption Tens of thousands of Afghan soldiers have been killed and injured. This is their story

Many in Afghanistan fear that a US-Taliban deal could see hard-won rights and freedoms eroded. The militants enforced strict religious laws and treated women brutally under their rule from 1996 to 2001.

What's the background to the Afghan war?

It began when the US launched air strikes one month following the 11 September 2001 attacks and after the Taliban had refused to hand over the man behind them, Osama Bin Laden.

The US was joined by an international coalition and the Taliban were quickly removed from power. However, they turned into an insurgent force and continued deadly attacks, destabilising subsequent Afghan governments.

The international coalition ended its combat mission in 2014, staying only to train Afghan forces. But the US continued its own, scaled-back combat operation, including air strikes.

The Taliban have however continued to gain momentum and last year the BBC found they were active across 70% of Afghanistan.

Media playback is unsupported on your device Media caption Zan TV presenter Ogai Wardak: "If the Taliban come, I will fight them"

Nearly 3,500 members of the international coalition forces have died in Afghanistan since the 2001 invasion, more than 2,300 of them American.

The figures for Afghan civilians, militants and government forces are more difficult to quantify. In a February 2019 report, the UN said that more than 32,000 civilians had died. The Watson Institute at Brown University says 58,000 security personnel and 42,000 opposition combatants have been killed.