BAGRAM AIR FIELD, Afghanistan — President Trump paid an unannounced Thanksgiving visit to American troops in Afghanistan on Thursday and declared that he had reopened peace negotiations with the Taliban less than three months after scuttling talks in hopes of ending 18 years of war.
“The Taliban wants to make a deal, and we’re meeting with them,” Mr. Trump said during a meeting with Afghanistan’s president, Ashraf Ghani, at the main base for American forces north of Kabul.
“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,” Mr. Trump added even as he reaffirmed his desire to reduce the American military presence to 8,600 troops, down from about 12,000 to 13,000.
Mr. Trump’s sudden announcement on peace talks came at a critical moment in the United States’ long, drawn-out military venture in Afghanistan, a time when the country is mired in turmoil over disputed election results and Americans at home are increasingly tired of an operation that began shortly after the Sept. 11 attacks.
The scope and prospects of any renewed negotiations remained unclear, and White House officials gave few details beyond Mr. Trump’s sudden revelation. On the flight to Afghanistan, Stephanie Grisham, the White House press secretary, had insisted that the secret trip was “truly about Thanksgiving and supporting the troops” and “nothing about the peace process” with the Taliban.
The Taliban made no official comment immediately after the late-night visit and Mr. Ghani said little afterward about any peace talks. “Both sides underscored that if the Taliban are sincere in their commitment to reaching a peace deal, they must accept a ceasefire,” Mr. Ghani wrote on Twitter. “We also emphasized that for any peace to last, terrorist safe havens outside Afghanistan must be dismantled.”
But while the Afghan government has long demanded that the Taliban agree to a cease-fire, no evidence has emerged that the group was willing to grant one. Instead, it has said it would discuss the possibility in negotiations with Afghanistan’s political leaders over the future of the country once the Americans agree to leave.
Mr. Trump made the visit, his first to Afghanistan, under a shroud of secrecy, arriving in a darkened airplane just after 8:30 p.m. local time and departing a few hours later on a trip that the White House had concealed from his public schedule for security reasons.
The president carried out the traditional role of feeding turkey and mashed potatoes to American troops in fatigues, then dined, mingled and posed for photographs before delivering remarks celebrating the American military before about 1,500 troops in an aircraft hangar.
But his visit also had an important political dimension. Mr. Trump, who angrily called off talks with the Taliban in September just as the sides appeared close to an accord, is searching for foreign policy achievements he can celebrate on the campaign trail over the next year. Several of his other marquee initiatives, including nuclear talks with North Korea and an effort to squeeze concessions out of Iran with economic pressure, have yielded few results.
During his short visit on the ground on Thursday, Mr. Trump boasted of American military successes against Al Qaeda and the Islamic State and suggested that the Taliban was eager to make a peace deal, but that he personally was indifferent to the outcome.
“The Taliban wants to make a deal — we’ll see if they make a deal,” Mr. Trump said. “If they do, they do, and if they don’t, they don’t. That’s fine.”
He also said that the Taliban was willing to agree to a cease-fire pending the more extensive accord, a matter of contention in the earlier talks but one that Mr. Ghani’s government has insisted on.
Mr. Trump arrived in Afghanistan one day after at least 13 people were killed when their car struck a roadside bomb on the way to a wedding party in Taliban-controlled territory in northern Afghanistan, officials said. Most of the victims were related to one another.
Mr. Trump’s suggestion that the United States would either reach a peace with the Taliban or achieve “total victory” was a sharp departure from his public expressions of frustration with what he has called America’s unending wars. American military leaders and diplomats have long ruled out the possibility of a military victory in Afghanistan. To the contrary, they say, a political settlement is the only path out of the war.
“Peace talks are the only responsible way forward, but it will be a hard and lengthy road,” said James Dobbins, who served as special envoy for Afghanistan and Pakistan under Presidents George W. Bush and Barack Obama.
“Some time ago, the choice seemed to be between talking or winning on the battlefield,” Mr. Dobbins added. “More recently, the options under consideration seem to be talking or losing — that is, withdrawing unilaterally.”
The president made a similar point when he stuck to his prepared remarks, declaring that the war “will not be decided on the battlefield” and that “ultimately there will need to be a political solution.” The vow of “total victory” absent a peace negotiation appeared to be spontaneous.
American diplomats have quietly tried to keep the peace process alive since Mr. Trump called off the talks, using small measures like a prisoner swap to build trust. In recent weeks, informal meetings between the two sides have been reported, though neither side had publicly acknowledged that peace negotiations had formally resumed.
Even after Mr. Trump broke off negotiations, the Taliban refrained from criticizing him too harshly, which analysts took as evidence that the group still wanted a deal with the United States.
The Thanksgiving trip also allowed the president to stand against a backdrop of visible military support amid his decision to intervene in several high-profile war crimes cases, which has roiled the Pentagon and strained his relations with military leaders.
The secretary of the Navy, Richard V. Spencer, was fired after Mr. Trump refused to allow the Navy to oust Chief Petty Officer Edward Gallagher from the Navy SEALs in a case that has taken on enormous symbolic importance. Chief Gallagher was convicted of bringing discredit to the armed forces by posing for photos with a teenage captive’s dead body in Iraq but acquitted of the most serious allegations, including killing the captive with a hunting knife and threatening to kill SEALs who reported him.
“This was a shocking and unprecedented intervention in a low-level review,” Mr. Spencer wrote in The Washington Post on Wednesday.
Administration officials said Mr. Trump remained eager to bring an end to the American role in Afghanistan, which costs billions of dollars each year and continues to claim American lives. This month, Mr. Trump visited Dover Air Force Base in Delaware to pay respects during the return of two Americans killed in a Nov. 20 helicopter crash in Afghanistan.
The peace negotiations with the Taliban collapsed in stunning fashion on Sept. 7, after Mr. Trump disclosed via Twitter that he was quashing plans for a dramatic meeting at his Camp David presidential retreat with Taliban leaders and Afghan government officials. Angrily citing a Taliban attack in Kabul that killed an American soldier as the plans were coming together, Mr. Trump called off the discussions entirely. “As far as I’m concerned, they are dead,” he said.
It was never clear how imminent a peace agreement truly was. Taliban leaders said they had not committed to a Camp David visit, and Mr. Ghani, who was shut out of the talks, was deeply skeptical of a separate United States agreement with the Taliban that did not involve his government. Uncertainty about the country’s future in the wake of its unresolved election dispute could make brokering peace even more difficult now.
Mr. Trump may be proceeding on his own. The goal of his past talks with the Taliban was to trade an American pledge to withdraw for a Taliban renunciation of its terrorist allies like Al Qaeda and the start of Taliban negotiations with Afghanistan’s government.
But American troops are already exiting the country as some units rotate out without being replaced. A month ago, the top American commander in Afghanistan, Gen. Austin Miller, said that United States forces in the country had dropped by 2,000 over the past year.
Some current and former military officials are worried that Mr. Trump’s appetite for a troop reduction he can boast about on the campaign trail as a fulfillment of his promise to scale back American foreign interventions could lead to serious national security risks.
Gen. David Petraeus, a former commander of American forces in Afghanistan who is now retired, has warned that a premature withdrawal could lead to a Taliban conquest of the country, and Senator Lindsey Graham, Republican of South Carolina and a close adviser to Mr. Trump on foreign policy, has said removing troops could “pave the way for another 9/11.”
Mr. Trump flew to Afghanistan on one of the modified blue-and-white 747 jets known as Air Force One when the president is onboard. He had flown to Florida on Tuesday in another one of those planes but left it behind for his secret trip, which involved first flying back to Washington, where he boarded an alternate plane out of public view.
Ms. Grisham acknowledged that the White House had arranged for Mr. Trump’s Twitter account to post generic Thanksgiving messages while he was in the air to prevent an unusually long silence that might draw suspicion about his activities.
Joining Mr. Trump were his acting chief of staff, Mick Mulvaney; the national security adviser, Robert C. O’Brien; and Senator John Barrasso, Republican of Wyoming and a member of the Senate Foreign Relations Committee who has regularly visited troops in Afghanistan on holidays.
Peter Baker contributed reporting from Washington, and Mujib Mashal from Kabul, Afghanistan.