President Donald Trump said Thursday the United States had 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, 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.

Donald Trump with US troops
US President Donald Trump speaks to the troops during a surprise Thanksgiving visit at Bagram Air Field, on November 28, 2019 in Afghanistan Photo: AFP / Olivier Douliery Olivier Douliery/AFP

About 13,000 US troops remain in Afghanistan, 18 years after the United States invaded following the September 11, 2001 attacks. 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 war-torn country, told the troops.

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

Trump joked that he had just started eating when he was called away, and didn't even get to taste his turkey.

US Troops
A US soldier stands guard during a surprise visit of US President Donald Trump at Bagram Air Field on November 28, 2019 in Afghanistan Photo: AFP / Olivier Douliery Olivier Douliery/AFP

"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."

US President Donald Trump
US President Donald Trump eats Thanksgiving dinner with US troops in Afghanistan Photo: AFP / Olivier Douliery Olivier Douliery/AFP

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 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," Trump later said during a meeting with Ghani, referring to the death of the soldier.

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

US President Donald Trump
US President Donald Trump serves Thanksgiving dinner to US troops at Bagram Air Field during a surprise visit on November 28, 2019 in Afghanistan Photo: AFP / Olivier Douliery Olivier Douliery/AFP

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

Trump said Thursday 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.

Afghanistan remains roiled by violence, and US presidents are still only able to make fleeting, unannounced visits to Bagram -- the biggest American base in the country -- due to the security threat.

Ghani, who was only given a few hours' notice about the visit, thanked 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.

Back in Washington, Trump's relations with the US military leadership have recently soured over his repeated interference in high-profile discipline cases.

Trump reversed the demotion of Navy SEAL Edward Gallagher who was accused of war crimes but only found guilty of a lesser offense.

Gallagher's cause had been championed by Fox News and Trump's conservative base.

The case drew sharp criticism from the top brass concerned that the president was undermining military judicial process.

Trump this month also dismissed a murder conviction against a soldier who ordered his men to fire on three unarmed Afghans in 2012.

And he granted clemency to another soldier charged with murder over the death of an alleged Taliban bomb maker in 2010.

Before taking the secret 13-hour flight to Afghanistan, Trump had been expected to spend Thanksgiving at his Mar-a-Lago residence in Florida and to make video calls to US troops deployed abroad.

Copyright AFP. All rights reserved.