Residents gather to view the damage after an al-Shabab car-bomb attack near a hotel in Mogadishu on Feb. 27. At least nine people were killed. (Feisal Omar/Reuters)

Somalia’s al-Shabab movement is emerging as one of the most loyal — and lethal — al-Qaeda affiliates, even as the Islamic State expands its reach into the region, according to Western and Somali analysts.

The Somali militants have shown signs of a resurgence, staging deadly attacks and assassinations in recent months, despite the billions of dollars being spent by the United States to fight them. That has prompted the Islamic State to try to woo them away from al-Qaeda, as U.S. and other Western intelligence officials grow increasingly alarmed.

The concern is so great that U.S. warplanes and drones attacked an al-Shabab training camp Saturday, killing more than 150 fighters, according to the Pentagon. It was the deadliest U.S. strike on the militant group — whose name in Arabic means “the youth” — since it emerged a decade ago with the goal of turning Somalia into a fundamentalist Islamic state.

“Al-Qaeda understands the ­potential of this self-financing and experienced insurgency in the strategic Horn of Africa,” said Abdirashid Hashi, director of the Heritage Institute for Policy Studies, a think tank based in the Somali capital, Mogadishu. “And ISIS, of course, understands this potential and hence its overtures for co-option or stage a hostile takeover. Al-Qaeda is probably working hard to protect its jewel from ISIS.” ISIS is another name for the Islamic State.

Less than two years ago, al-Shabab was a crippled movement. U.S.-backed African Union forces had driven the militia out of Mogadishu and other areas. Its leader, Mukhtar Abu Zubeyr, widely known as Ahmed Abdi Godane, was killed in a U.S. airstrike a year after he masterminded an attack on a posh Nairobi mall that killed scores. His death was hailed by U.S. officials as a major operational and symbolic blow to the militia; many thought it would result in the group’s fragmentation and eventually lead to its demise.

Instead, it regrouped under a new leader, Ahmad Umar, and transformed itself into a lethal guerrilla insurgency. Its fighters have raided parts of the countryside, setting up roadblocks and controlling the population. They have expanded their recruitment and presence in Kenya and other neighboring countries. In Somalia, they have been aided by incessant political infighting, poorly trained and equipped national security forces, and a weak central government that has not been able to fill the void.

Thinly stretched African Union peacekeepers, known by the acronym AMISOM and funded by U.S. and other Western governments, seldom pursue the militia into rural areas, focusing instead on cities and towns. That has allowed the militants to stage spectacular attacks from their rural strongholds.

Al-Shabab has also attacked restaurants, beachfront bars and other soft targets while dispatching assassination squads to eliminate government officials.

“Al-Shabab dominate in the countryside in the newly liberated areas, where neither AMISOM nor the Somali army so far have been successful in establishing security for the locals,” said Stig Jarle Hansen, a Norwegian researcher who authored a book on the group. “In these areas, they can tax and even use forced recruitment.”

Since January, the militia has killed scores of people, including Kenyan soldiers attached to AMISOM at their base and guests at a Mogadishu hotel. It also asserted responsibility for a bomb planted on a jetliner that ripped a hole through the fuselage, forcing the plane to land in Mogadishu, and for a bomb that detonated in a laptop on Monday at the airport in the central Somali town of Beledweyne.

While U.S. officials described Saturday’s airstrikes as a major success that apparently killed more militants than all previously known U.S. operations in Somalia combined, some analysts expressed caution. The presence of such a large number of fighters at one camp is “a worrying indicator of the group’s continued relevance and its power to attract, notwithstanding the setbacks it has suffered in recent years,” said J. Peter Pham, director of the Africa Center at the Atlantic Council.

“If anything, despite the killing of several of its leaders and battlefield reverses the group has suffered, its hard-line ‘core’ has become even more radicalized and, indeed, have seen their ambitions grow,” he added.

Saturday’s airstrikes marked an escalation and a sharp tactical shift for U.S. military operations in Somalia.

Over the past decade, the Pentagon had cast a surveillance blanket over Somalia to gather intelligence on al-Shabab, but it rarely opened fire. Before this month, there had been only about a dozen recorded U.S. drone strikes in Somalia since 2003. Each had targeted individual al-Shabab leaders whom U.S. forces had long been hunting.

Last weekend’s attack, by contrast, was aimed squarely at a gathering of low-level fighters in an attempt to inflict mass casualties. Officials at the Pentagon said they feared the fighters at the training camp, about 120 miles north of Mogadishu, were preparing to mount a major attack on A.U. troops and also represented a threat to the handful of U.S. military advisers in Somalia.

“We do believe there was a direct threat,” Pentagon spokesman Peter Cook told reporters Tuesday, while declining to provide details about intelligence assessments. “And we believe that this strike has been successful in reducing that threat.”

Al-Shabab has demonstrated a growing ability to launch ambitious, large-scale attacks against A.U. forces in recent months. In January, for instance, the group’s fighters overran an A.U. base in el-Adde, Somalia, and killed more than 100 Kenyan soldiers.

In September, al-Shabab fighters killed about 50 Ugandan troops at another A.U. base in Somalia, and in June, the group killed 70 Burundians belonging to the same force at yet another such encampment.

Army Gen. David M. Rodriguez, the head of the U.S. military’s Africa Command, said U.S. officials were worried that the al-Shabab camp targeted in Saturday’s airstrike was preparing for a similar attack on A.U. troops.

“The camps are transitory, so they pop up and they move and they’re at different places throughout Somalia at different times,” he told the Senate Armed Services Committee during a hearing Tuesday.

“It is a concern because the last three times they did something similar to this, they had an ability to conduct a devastating attack on the [A.U.] forces,” he said.

There are more than 20,000 A.U. troops in Somalia, drawn primarily from Uganda, Kenya, Burundi and Ethiopia. Their primary funder is the United States, which foots a large part of the bill for training and equipping the international force.

Given the resurgence and success of al-Shabab’s attacks, however, U.S. officials have become increasingly concerned that their African partners might lose resolve for the fight.

Rodriguez told the Senate panel that regional powers remain “committed to the mission” but that “because of the existing tactics that al-Shabab has taken, they need to start making adjustments, too, and that’s what we’re working with them on.”

As it has grown again, al-Shabab has drawn the attention of the Islamic State. In videos and on social media, Islamic State leaders have urged the militia to abandon al-Qaeda and join their fold, part of an ongoing contest for influence between the two most influential militant groups.

Last year, Nigeria’s Boko Haram militia pledged allegiance to the Islamic State. That was considered a setback for al-Qaeda’s central branch in Pakistan and Afghanistan, which has increasingly relied on local and regional affiliates — in Africa, the Arabian Peninsula and other areas — to spread its radical philosophies and target the West and its allies.

But al-Shabab’s senior leaders have shown little inclination to break away from al-Qaeda. Godane and other top leaders trained and fought with Osama bin Laden in Afghanistan. Their agenda is also more nationalistic and regional, unlike the Islamic State’s global ambitions.

Al-Qaeda is believed to have provided financing, training and logistical support to al-Shabab. And while there have been some defections to the Islamic State, the militia has shown no visible signs of fragmenting or weakening.

“Because of al-Qaeda’s weakness, al-Shabab have been more important,” Hansen said. “They actually presented a victory for al-Qaeda in the face of the Islamic State.”

Whitlock reported from Washington.

Read more:

Today’s coverage from Post correspondents around the world