Media playback is unsupported on your device Media caption Donald Trump told US troops it was the first Thanksgiving that he didn't get any Turkey

President Donald Trump made an unannounced visit to US troops in Afghanistan - his first time in the country - for the Thanksgiving holiday.

During the brief appearance at Bagram Airfield, Mr Trump served turkey to soldiers, posed for photographs, and met Afghan President Ashraf Ghani.

In a speech to troops, Mr Trump said the US was in talks with the Taliban, which he said "wants to make a deal".

Mr Trump also said the US was "substantially" reducing troop numbers.

Some 13,000 US troops remain in Afghanistan 18 years after the US intervention to oust the Taliban following the 11 September 2001 attacks.

The visit comes after a prisoner swap with the Taliban aimed at resuming peace negotiations.

Earlier this month, the Taliban freed two Western academics who had been held hostage since 2016 - American Kevin King and Australian Timothy Weeks - in exchange for three imprisoned senior militants.

"We're meeting with them [Taliban] and we say it has to be a ceasefire and they didn't want to do a ceasefire and now they want to do a ceasefire," Mr Trump said at the base near the capital, Kabul. "I believe it will probably work out that way."

It is not clear how substantive the talks have been.

Afghan officials have long demanded a ceasefire but the Taliban, who now control more territory than at any point since they were ousted in 2001, have refused to hold direct talks with the government until a US deal is agreed.

Taliban leaders confirmed that meetings with senior US officials were being held in Doha since last weekend but that formal talks had not yet resumed, Reuters news agency reported.

Mr Trump also reaffirmed his plan to cut troop levels to about 8,600 but did not say how many personnel would leave or when. "We're going to stay until such time as we have a deal or we have total victory, and they want to make a deal very badly."

What else happened at the visit?

Mr Trump arrived at 20:30 local time (16:00 GMT) on Thursday and left before midnight on a trip that was shrouded in secrecy for security reasons. The White House confirmed that there was an arrangement for the president's Twitter account to post messages during the trip to prevent suspicions arising about his long silence.

Image copyright AFP Image caption Donald Trump said the Taliban "wants to make a deal"

Upon his arrival, Mr Trump was greeted by US Joint Chiefs Chairman Gen Mark Milley who, on Wednesday, said the chances of a successful outcome from peace talks were higher than before and could happen in the "near term".

The president, who travelled with a number of aides, then served turkey to troops, sat down to eat Thanksgiving dinner with them before posing for photos.

"There is nowhere I'd rather celebrate this Thanksgiving than right here," Mr Trump said, "with the toughest, strongest, best and bravest warriors on the face of the earth."

President Ghani thanked the US troops who have made the "ultimate sacrifice" in Afghanistan, saying: "Afghan security forces are taking the lead now."

Reacting to the meeting on Twitter later, Mr Ghani did not mention Mr Trump's comments about talks with the Taliban and said: "Both sides underscored that if the Taliban are sincere in their commitment to reaching a peace deal, they must accept a ceasefire."

There was no immediate reaction from the Taliban, and many have previously raised questions over the group's willingness to engage in serious negotiations or whether it can be trusted.

A foreign visit with domestic aims

By Chris Buckler, North America correspondent

Donald Trump is proud of the military might of his country but this trip overseas should not be interpreted as a sign of his interest in the region. The commander-in-chief has repeatedly stated that he wants his troops home and not bogged down in seemingly endless conflicts like the one in Afghanistan, which holds the unenviable title of America's longest war.

Mr Trump's priorities lie inside the borders of the US - borders that he is keen to strengthen. But foreign policy is important to members of his Republican Party, as the "America First" president learned when he was heavily criticised for his apparent acquiescence to Turkey's invasion of northern Syria.

Since then he has been able to claim a share of the success in the US special forces operation that led to the death of the leader of the Islamic State group, Abu Bakr al Baghdadi. And now there is the teasing possibility of a peace deal with the Taliban.

Mr Trump talked up the potential of an agreement - but it is not clear how much has changed since he pronounced negotiations "dead" in September.

While these are foreign policy issues it is worth recognising that for every president visits like this tend to play into domestic politics - last Christmas, President Trump flew to Iraq. Showing solidarity with soldiers abroad is important for support back home, particularly at holiday time when those troops are thousands of miles away from their families.

What happened to the peace talks?

Talks with the Taliban collapsed in September soon after President Trump invited senior Taliban leaders and President Ghani to meet at the US presidential retreat of Camp David, near Washington DC.

But a Taliban attack in the Afghan capital two days earlier, which killed a US soldier and 11 others, prompted Mr Trump to pull out, saying the group "probably don't have the power to negotiate" if they were unable to agree to a ceasefire during talks.

Mr Ghani said this month's prisoner exchange aimed to "facilitate direct peace negotiations." However, the Taliban have long refused to negotiate with Mr Ghani's administration, calling it a puppet of the US.