President Donald Trump made a surprise visit to Afghanistan on Thursday to visit American troops for Thanksgiving.

The trip, his first to the country, comes almost a year after the president made a surprise visit to troops stationed in Iraq, his first to a combat zone since he took office.

Around 13,000 U.S. personnel are still stationed in Afghanistan to train, advise and assist local forces under a NATO mission, and to conduct counterterrorism operations.

Trump said this summer that he aimed to reduce that figure, and last month the top U.S. general in Afghanistan said the total number of troops in the country had decreased by around 2,000.

The war in Afghanistan is the longest in U.S. history, claiming some 147,000 lives since the conflict started in 2001, including about 40,000 civilians, 60,000 Afghan security forces and 3,500 coalition trips — about 2,400 of them Americans, according to a study from Brown University.

The U.S.-led invasion toppled the Taliban government from power after it harbored 9/11 mastermind Osama bin Laden.

Department of Defense spending in Afghanistan has so far cost the U.S. taxpayer $765 billion, and the Afghan government still only controls some 53 percent of the country's territory amid the ongoing conflict, according to a report by a U.S. government watchdog.

There have been nine rounds of peace negotiations between the U.S. and the Taliban, but in September the president announced that he was calling these off after a U.S. service member was killed in a suicide attack in the capital Kabul.

The U.S.'s top general said Wednesday he was optimistic the negotiations would resume.

The visit comes at a tumultuous time in the Trump presidency, following public testimony from senior diplomats in the House impeachment inquiry. They portrayed the president's attempts to pressure Ukraine to investigate former Vice President Joe Biden, a potential Democratic rival in the 2020 presidential race, an allegation Trump denies.