But he cancelled the secret meeting at his Camp David retreat after the militants admitted they were behind a recent attack that killed a US soldier.

The US invaded Afghanistan and overthrew the Taliban in 2001.

The militants had provided a safe haven for the al-Qaeda network to plan the 11 September 2001 attacks on the US.

A source from the Taliban’s political office in Doha told the BBC that the group was set to hold an “urgent internal meeting” to discuss Mr Trump’s decision.

How surprising is this news?

A face-to-face meeting with the Taliban at Camp David, just ahead of the 18th anniversary of 9/11, would have been an extraordinary diplomatic move by the US president.

The top US negotiator had announced a peace deal “in principle” on Monday.

It was the result of nine rounds of talks between the US and Taliban representatives, held in Doha, the capital of the Gulf state of Qatar.

But Mr Trump’s tweets on Saturday evening appeared to put an end to nearly a year of painstaking negotiations which had excluded the Afghan government in Kabul, dismissed by the Taliban as American puppets.

“Unfortunately, in order to build false leverage, [the Taliban] admitted to an attack in Kabul that killed one of our great great soldiers,” the president tweeted.

“I immediately cancelled the meeting and called off peace negotiations.

“What kind of people would kill so many in order to seemingly strengthen their bargaining position? They didn’t, they only made it worse!”

Media playback is unsupported on your device

Media captionTens of thousands of Afghan soldiers have been killed and injured. This is their story

As part of the proposed deal, the US would have withdrawn 5,400 troops from Afghanistan within 20 weeks, in return for Taliban guarantees that the country would never again be used as a base for terrorism.

However, Zalmay Khalilzad, the US peace envoy and lead negotiator, had said on Monday that final approval still rested with Mr Trump.

The US currently has about 14,000 troops in Afghanistan

What about the attacks in Afghanistan?

On Thursday, a Kabul car bombing carried out by the Taliban killed 12 people, including a US soldier.

A Romanian soldier serving with the Nato-led mission was also killed.

But the Taliban had never agreed to end their violent campaign against Afghan and foreign forces while the peace talks were taking place.

A recent escalation of violence had deepened fears that a looming US-Taliban agreement would not end the daily violence in Afghanistan and its toll on civilians.

Ever since the US envoy Zalmay Khalilzad arrived in Kabul a week ago with news of “a deal in principle,” there have been almost daily Taliban attacks, with a growing chorus of anger in Afghanistan – and the US.

The Taliban say they’re targeting foreign forces. But time and again, Afghan civilians are suffering.

The new agreement is said to only include a commitment to reduce violence. A senior US diplomat explained they’d accepted the Taliban argument that a ceasefire was their main bargaining chip for Afghan talks set to follow the US negotiations.

A senior Afghan official angrily told me “a ceasefire is our bargaining chip too,” insisting the government would not accept the current deal. Afghan leaders accuse the US of bestowing legitimacy on the Taliban, which has only emboldened them.

There is also mounting scepticism, now voiced by President Trump, that any commitments made by Taliban negotiators in Doha won’t be upheld by commanders in the field

What does each side want from the talks?

Mr Trump pledged during the 2016 presidential campaign that he would end the US war in Afghanistan.

But he recently said that he wanted to get troop numbers down to 8,600 – about the same as the level when he entered office – and then “make a determination from there”. He said the US would maintain a military presence in Afghanistan.

Many in Washington fear that a full US pull-out would leave the country deeply unstable and vulnerable to militant groups that could use it as a base to attack the West.

The Taliban militants now control more territory than at any time since the 2001 US invasion and have insisted that they will not talk formally with the Afghan government until a timetable for the US troop withdrawal is agreed.

The initial US-Taliban deal was meant to pave the way for intra-Afghan talks to find a broader political solution.

Some in Afghanistan fear that any deal could see hard-won rights and freedoms eroded and the Taliban back in power. The militants enforced strict religious laws and treated women brutally during their rule from 1996 to 2001.

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.