LOUMBILA, Burkina Faso — President Trump has ordered most American troops to withdraw from Syria. He wants to bring home thousands more from Afghanistan. Now hundreds of United States commandos and other forces are leaving West Africa — despite an onslaught of attacks from an increasingly deadly matrix of Islamist fighters.

The shift has unnerved African commanders in Burkina Faso and neighboring nations in the Sahel, a vast sub-Saharan scrubland increasingly racked by bombings, massacres, kidnappings and attacks on hotels frequented by Westerners. It is a region in which most Americans were unaware of United States military involvement until four Army soldiers were killed in a deadly 2017 ambush in Niger by Islamic State fighters.

What is emerging, critics said, is a glimpse of what happens when American troops, especially Special Operations forces, pull back before insurgents are effectively subdued, leaving local or allied forces to fend off the Islamic State, Al Qaeda or their offshoots.

“It’s a real problem,” Col. Maj. Moussa Salaou Barmou, commander of Niger’s Special Operations forces, said of the drawdown and the closing of seven of eight American elite counterterrorism units operating in Africa.