BAGRAM AIR BASE, Afghanistan — President Trump visited Afghanistan for the first time on Thursday, delivering Thanksgiving greetings to U.S. troops deployed here in America’s longest-running war and announcing he had resumed peace negotiations with the Taliban.

Making an unannounced trip, Trump touched down at 8:30 p.m. local time at Bagram air base — the primary hub for U.S. air operations located outside the capital of Kabul — after secretly departing Florida in the dark of night.

Trump has long wanted to draw down forces in Afghanistan; he said during a meeting here with Afghan President Ashraf Ghani that he had restarted peace talks with the Taliban that he had broken off almost three months ago and was hopeful of brokering an accord.

“The Taliban wants to make a deal and we’re meeting with them and we’re saying it has to be a cease-fire and they didn’t want to do a cease-fire, and now they do want to do a cease-fire,” Trump said. “I believe it’ll probably work out that way.”

The Trump administration appeared to be on the brink of striking a deal to jump-start the peace process in September, when the president extended and then canceled an invitation for Taliban representatives to come to Camp David to cement an agreement to reduce U.S. forces.

This is Trump’s second visit to a combat zone; he visited troops in Iraq the day after Christmas in 2018. Vice President Pence made a surprise trip last week to Al Asad air base in Iraq, where he served turkey and greeted troops.

Addressing about 1,500 military personnel assembled in an aircraft hangar here, Trump said, “We are winning like we haven’t won in a long time.”

President Trump made an unannounced visit to U.S. troops in Afghanistan on Nov. 28 to celebrate Thanksgiving Day. (The Washington Post)

He told the crowd he wanted a military victory in Afghanistan, and “we don’t play for ties,” but explained success would not be achieved on the battlefield but rather through “a political solution” determined by people in the region.

The president also served turkey to troops in a cafeteria and posed for photos with many of them.

Trump was on the ground at Bagram for about 3½ hours after flying there overnight from the United States. His visit was shrouded in secrecy and kept off his public schedule, and aides took extreme security precautions to transport the commander in chief to Afghanistan.

Trump, who had been vacationing with family at his Mar-a-Lago Club in Palm Beach, Fla., flew from an undisclosed Florida airport after nightfall Wednesday to Joint Base Andrews near Washington, where he boarded Air Force One for the 13-hour flight to Afghanistan.

The president’s aircraft took off without lights and with its cabin window shades drawn shut to preserve secrecy. To limit suspicions about Trump’s whereabouts, White House staff sent tweets from the president’s Twitter account during the time he was flying.

Air Force One descended and touched down at Bagram in complete darkness, and once on the ground, the president was flanked by combat troops wearing night-vision goggles and bearing rifles.

First lady Melania Trump remained in Florida. The president was accompanied by a retinue of senior aides, as well as Sen. John Barrasso (R-Wyo.). He was joined here by Gen. Mark A. Milley, chairman of the Joint Chiefs of Staff, who already had been traveling in the region.

During Trump’s bilateral meeting with Ghani, he confirmed that he would like to reduce the number of U.S. troops in Afghanistan to 8,600, down from about 13,000.

“We’ve made tremendous progress and at the same time we’ve been drawing down our troops,” Trump said.

Ghani told Trump that “Afghan security forces are taking the lead now.”

Trump’s visit had a political dimension, too. With House Democrats poised to impeach him for abusing his office and military leaders alarmed by his intervention in war crimes cases, Trump stood with cheering service members as a reminder that for all his troubles in Washington, he remains the commander in chief.

After Trump addressed a campaign rally-style crowd in the hangar, Ghani took the stage to heap praise on him.

Ghani celebrated Trump as the architect of a strategy that had helped weaken the Islamic State and al-Qaeda, and personally credited him for the killing of ISIS leader Abu Bakr al-Baghdadi — which Ghani suggested was more important than the killing of the former al-Qaeda leader Osama bin Laden, mastermind of the Sept. 11, 2001, terrorist attacks on the United States.

“I’d like to thank you for your leadership, for your determination,” Ghani told Trump. He also expressed gratitude to Trump for “your very principled decisions regarding putting limits on the type of peace that will ensure the gains of the past year and ensure your security and our security.”

Trump has repeatedly questioned why the United States has kept troops in Afghanistan after nearly two decades of fighting, billions of dollars in aid and more than 2,000 U.S. military lives have failed to transform the country’s security.

Nineteen U.S. service members have been killed this year in Afghanistan by hostile forces, an increase from 2018.

Trump campaigned in 2016 on withdrawing the United States from foreign wars, but in 2017, he agreed to authorize an increase in U.S. forces as part of a major strategy overhaul of the war. The president’s patience appears to have been wearing thin, however.

Trump complained on Twitter in September that U.S. forces have been acting as “policemen” for Afghanistan. “That was not meant to be the job of our Great Soldiers, the finest on earth,” he wrote.

The Afghan army continues to struggle to mount offensive operations and suffers high casualties 18 years after international forces first arrived in the wake of the Sept. 11 attacks.

Ghani recently announced a step forward in his country’s battle against the Afghan branch of the Islamic State after at least several hundred of the hard-line militants surrendered to the government.

But the Taliban still poses a formidable threat, retaining an estimated force of 40,000 to 60,000 militants who hold sway across many of Afghanistan’s remote areas and represent the only form of governance in certain places.

Gen. Austin “Scott” Miller, commander of the U.S. coalition forces here, has already executed a modest reduction in the U.S. force level to about 13,000. But further withdrawals appear to be on hold for now as diplomats seek a breakthrough in hoped-for peace talks.

It remains unclear whether Trump will order more troops home in the absence of a political resolution to the war.

Miller has said he could conduct the current mission, which includes training and support to Afghan forces and a parallel counterterrorism effort, with as few as 8,600 U.S. troops.

The concern about Afghanistan’s future is compounded by prolonged uncertainty surrounding the results of presidential elections in September. Ghani, a former World Bank official, is seeking another term; his challengers include Abdullah Abdullah, who has served as chief executive since September 2014.

Military commanders point to some improvements in Afghanistan’s fighting ability but anticipate the Kabul government would face an existential threat if foreign troops were to withdraw.

For the Pentagon, the fact that the Afghanistan war has stayed largely out of the headlines of late has been beneficial as officials try to better position the Afghan government.

Rucker reported from West Palm Beach, Fla.