U.S. President Donald Trump said Saturday that he had called off "peace negotiations" with the Taliban, talks which had appeared to be on the brink of a landmark deal to bring an end to 18 years of war.

He also revealed that he had been set to meet in secret on Sunday with top Taliban leaders and Afghan President Ashraf Ghani at Camp David, but that the meeting was now off following an attack in Kabul that left one US service member dead.

"Unbeknownst to almost everyone, the major Taliban leaders and, separately, the President of Afghanistan, were going to secretly meet with me at Camp David on Sunday. They were coming to the United States tonight," Trump tweeted.

"Unfortunately, in order to build false leverage, they admitted to an attack in Kabul that killed one of our great great soldiers, and 11 other people.

"I immediately cancelled the meeting and called off peace negotiations," Trump said of the talks which had been ongoing for a year.

"What kind of people would kill so many in order to seemingly strengthen their bargaining position?" he tweeted.

Kabul has been gripped by a surge in deadly violence even after the US and the insurgents reached an agreement "in principle" that would see the US pull thousands of troops from Afghanistan in return for various Taliban security promises.

Any deal would have needed final approval from Trump, who has said that he wants to end American involvement in Afghanistan, launched after the September 11, 2001 attacks. According to parts of the deal made public, the Pentagon would have pulled about 5,000 of its roughly 13,000 or so troops from five bases across Afghanistan by early next year.