WASHINGTON — President Trump, continuing his end-of-term troop withdrawals from conflicts around the world, will pull American troops out of Somalia, where they have been involved in trying to push back advances by Islamist insurgents in the Horn of Africa.
The Pentagon announced on Friday that virtually all of the approximately 700 troops in Somalia — most Special Operations troops who have been conducting training and counterterrorism missions — will be leaving by Jan. 15, five days before President-elect Joseph R. Biden Jr. is scheduled to be inaugurated.
Many of the troops will be “repositioned” to nearby Kenya, a Defense Department official said Friday. It was not immediately clear whether other parts of the American presence in Somalia — such as C.I.A. officers, the ambassador and other State Department diplomats who are based at a heavily fortified bunker at the airport in Mogadishu, the Somali capital — will also withdraw from Somali territory along with the military.
The withdrawal from Somalia followed Mr. Trump’s orders to reduce the American presence in Afghanistan and Iraq, and reflected the president’s longstanding desire to end long-running military engagements against Islamist insurgencies in failed and fragile countries in Africa and the Middle East, a grinding mission that has spread since the Sept. 11, 2001, attacks.
The Pentagon pledged that efforts to safeguard American interests would continue.
“The U.S. is not withdrawing or disengaging from Africa,” it said in a statement. “We remain committed to our African partners and enduring support through a whole-of-government approach.”
The United States will retain the ability to conduct counterterrorism operations in Somalia, especially drone strikes, and to collect early warnings and indicators regarding threats to the United States and allies from militant forces in the country.
The mission in Somalia was in the spotlight in recent days, after it was reported that a veteran C.I.A. officer was killed in combat in Somalia, according to current and former American officials. The death already has rekindled debate over American intelligence’s counterterrorism operations in Africa. The officer was a member of the C.I.A.’s paramilitary division, the Special Activities Center, and a former member of the Navy’s elite SEAL Team 6.
The troop withdrawal from Somalia comes just two weeks after Mr. Trump ordered the military to withdraw troops from Afghanistan, halving the number there to just over 2,000. Reductions in the American troop presence in Iraq also are underway.
Also this week, the Pentagon policy official overseeing the military’s efforts to combat the Islamic State in Iraq and Syria was fired after a White House appointee told him that the United States had won that war and that his office had been disbanded. The ouster of the official, Christopher P. Maier, the head of the Pentagon’s Defeat ISIS Task Force since March 2017, came just three weeks after Mr. Trump fired Defense Secretary Mark T. Esper and three other Pentagon officials and replaced them with loyalists.
Acting Defense Secretary Christopher C. Miller, who has been carrying out Mr. Trump’s purge at the Pentagon since he took over from Mr. Esper last month, characterized the moves as reflecting the success of the American-led effort to crush the terrorist state that the Islamic State created in large sections of Iraq and Syria.
Defense Department officials familiar with internal deliberations said the Somalia pullout would not apply to American forces stationed in nearby Kenya and Djibouti, where American drones that carry out airstrikes in Somalia are based.
Keeping those air bases would mean retaining the military’s ability to use drones to attack militants with the Shabab, a Qaeda-linked terrorist group — at least those deemed to pose a threat to American interests.
Exiting foreign conflicts has been a central component of Mr. Trump’s “America First” agenda since he ran for office in 2016. That appeal has particularly animated his base of populist voters, many of them veterans who have grown weary of their roles in longstanding wars. The president views his record on this issue as important to any political future he might pursue.
Most American troops in Somalia, the war-torn nation in the Horn of Africa, are Special Operations forces stationed at a small number of bases across the country. Their missions include training and advising Somali Army and counterterrorism troops and conducting kill-or-capture raids of their own targeting Shabab militants.
The Pentagon has long argued that the United States can safely leave areas contested by militants when the local governments can safeguard their own territory. Mr. Trump’s order means direct training efforts with Somalia security forces would end.
Mr. Trump’s push to leave Somalia before the end of his term comes at a delicate time: Somalia is preparing for parliamentary elections next month and a presidential election scheduled for early February. The removal of American troops could complicate any ability to keep election rallies and voting safe from Shabab bombers. It also comes at a time of political turmoil in neighboring Ethiopia, whose army has also battled the Shabab.
Somalia has faced civil war, droughts and violence from Islamist extremists for years. The United States intervened in the country as peacekeepers, but abandoned it not long after the “Black Hawk Down” battle in 1993, which killed 18 Americans and hundreds of militia fighters.
The Shabab, an Islamist terrorist group whose name means “the youth,” emerged around 2007 and have violently vied for control of Somalia with occasional attacks outside its borders, including an attack on the Westgate shopping mall in Nairobi, Kenya, in 2013 that killed more than five dozen civilians and a deadly assault on an American air base at Manda Bay, Kenya, in January.
Shabab leaders pledged allegiance to Al Qaeda in 2012. In 2016, shortly before leaving office, the Obama administration deemed them part of the congressionally authorized war against the perpetrators of the Sept. 11 attacks. Under the Trump administration, the military sharply increased airstrikes targeting Shabab militants.