US President Donald Trump said the United States has resumed talks with Taliban insurgents as he made a surprise trip to Afghanistan to celebrate the Thanksgiving holiday with troops.

On a brief visit to Bagram Airfield outside the capital Kabul, Mr Trump served turkey dinner to soldiers, posed for photographs and delivered a speech after meeting Afghan President Ashraf Ghani.

"The Taliban wants to make a deal and we're meeting with them and we're saying it has to be a ceasefire," he told reporters.

About 13,000 US troops remain in Afghanistan, 18 years after the United States invaded following the 11 September 2001 attacks.

President Trump said he planned to reduce the number to 8,600, and later added "we can go much further than that," without giving details.

"There's nowhere I'd rather celebrate this Thanksgiving than right here with the toughest, strongest, best and bravest warriors on the face of the earth," the president, who was making his first trip to the country, told the troops.

"I've just come from serving Thanksgiving dinner to some of you... and we had a good time."

Mr Trump joked that he had just started eating when he was called away, and did not even get to taste his turkey.

"I should've started with that, instead of the mashed potatoes," he said.

"But I hope everyone enjoyed the fantastic meal, it certainly did look good and hopefully everyone can get some well-deserved rest this holiday."

The United States earlier this year reached a deal with Taliban insurgents to pull US troops from Afghanistan and wind down America's longest war in return for security guarantees.

But President Trump made a shock move in September, describing the year-long talks as "dead" and withdrawing an invitation to the insurgents to meet in the United States due to the killing of an American soldier.

"We were getting close and we pulled back. We didn't want to do it because of what they did," he later said during a meeting with Mr Ghani, referring to the death of the soldier.

"Since then, we've hit them so hard, they've never been hit this hard."

The Taliban refuse to negotiate formally with the Afghan government, though diplomatic efforts have continued to foster dialogue and an eventual peace deal.

Mr Trump said yesterday that the war in Afghanistan "will not be decided on the battlefield" and that "ultimately there will need to be a political solution" decided by people in the region.

The US President has often vowed to pull out of the US's "endless wars," and he is keen to withdraw many troops from Afghanistan ahead of the November 2020 election when he faces a tough battle to win a second term.

Mr Ghani, who was only given a few hours' notice about the visit, thanked Mr Trump for pushing for "the type of peace that will ensure the gains of the past year and ensure your security and our security."

The Taliban last week handed over two hostages - an American and an Australian - after three years in captivity in exchange for three high-ranking insurgent prisoners, a move seen as a boost to peace talks.