WASHINGTON — The Obama administration has intensified a clandestine war in Somalia over the past year, using Special Operations troops, airstrikes, private contractors and African allies in an escalating campaign against Islamist militants in the anarchic Horn of Africa nation.

Hundreds of American troops now rotate through makeshift bases in Somalia, the largest military presence since the United States pulled out of the country after the “Black Hawk Down” battle in 1993.

The Somalia campaign, as it is described by American and African officials and international monitors of the Somali conflict, is partly designed to avoid repeating that debacle, which led to the deaths of 18 American soldiers. But it carries enormous risks — including more American casualties, botched airstrikes that kill civilians and the potential for the United States to be drawn even more deeply into a troubled country that so far has stymied all efforts to fix it.

The Somalia campaign is a blueprint for warfare that President Obama has embraced and will pass along to his successor. It is a model the United States now employs across the Middle East and North Africa — from Syria to Libya — despite the president’s stated aversion to American “boots on the ground” in the world’s war zones. This year alone, the United States has carried out airstrikes in seven countries and conducted Special Operations missions in many more.