The US Africa Command has maintained some 700 troops, personnel from other US security operations, and private security contractors in Somalia, both conducting attacks on Al-Shabaab and training Somali forces.
The US personnel have sustained some casualties, including the death of a CIA officer in late November.
Acting Defense Secretary Chris Miller visited Somalia a week ago, where he “reaffirmed US resolve in seeing the degradation of violent extremist organizations that threaten US interests, partners, and allies in the region,” the Pentagon said.
The move came as Trump has sought to wind down US military engagements abroad in his final weeks in office.
He ordered US troop levels to be slashed by mid-January in Afghanistan and Iraq, to 2,500 troops in both cases.
The Pentagon said Friday that some of the personnel being pulled out of Somalia will be reassigned to neighboring countries to allow cross-border operations against extremist groups in conjunction with partner forces.
“The US will retain the capability to conduct targeted counterterrorism operations in Somalia, and collect early warnings and indicators regarding threats to the homeland,” it said.