When Navy SEALs were met with gunfire as they attempted a raid on a seaside militant compound in southern Somalia early Saturday, the commander of the operation had the authority to call in a U.S. airstrike. Instead, he opted to retreat.

The site had been under surveillance, and the operation against an al-Qaeda-affiliated group had been in the planning stages, for months, current and former Obama administration officials said Monday. A drone strike against the al-Shabab compound had been rejected, officials said, because there were too many women and children inside, the same reason that the commander opted against an airstrike once the operation was underway.

Destroying the compound probably would also have defeated a primary purpose of the mission: to capture, not kill, a Kenyan-­born al-Shabab commander named Abdulkadir Mohamed Abdulkadir, also known as Ikrima. He has long been on a U.S. “capture or kill” list, along with al-Shabab leader Mukhtar Abu Zubeyr, known as Godane, and was considered the group’s primary planner of attacks outside Somalia.

As they provided more details of the aborted operation in the town of Barawe, current and former administration officials said it was designed within restrictive counterterrorism guidelines that President Obama signed in the spring. Under the 2001 congressional Authorization for the Use of Military Force, the guidelines say that lethal force can be used only when there is a “near certainty that non-combatants will not be injured or killed.”

If civilians had not been present at the compound, a senior administration official said, “we might just as well have done a standoff strike,” hitting the site with missiles launched from piloted or unmanned aircraft. The desire to avoid hitting non-combatants, the official said, “accounts for the fact that ultimately [U.S. forces] disengaged” when they “met resistance.”

The guidelines also codify a long-stated but rarely implemented administration preference for capturing rather than killing terrorism targets.

Officials cited the Somalia operation, as well as the capture of an al-Qaeda figure in Tripoli, Libya, on the same day, as proof that the administration is not overly enamored with the relatively risk-free use of drones at the expense of detaining militants to glean intelligence.

“To people who had said we don’t undertake capture operations, here are two,” the senior official said.

The decision to launch the raid closely followed an al-Shabab attack last month on a Nairobi shopping mall frequented by Westerners. Public statements by the administration Monday also alleged that Ikrima was “closely associated” with the al-Qaeda planners of the 1998 bombing of the U.S. embassies in Kenya and Tanzania.

But administration officials, speaking about intelligence matters on the condition of anonymity, said neither of those events was the justification for the attempted raid. The mall attack, they said, served only as further indication that al-Shabab has expanded its range and will soon directly target Americans in the region.

Equally important for the timing of the raid was the growing concentration of militant leaders in Barawe, where they had set up a headquarters after being driven out of the Somali capital, Mogadishu, and the city of Kismayo by a multinational African force that is bolstering Somalia’s new civilian government.

Barawe was considered a relatively soft target. “It obviously makes a big difference if you can come ashore,” rather than risk the noise and exposure of an approach by land or air, according to a former U.S. counterterrorism official. “It’s not like there’s any air defense there,” the former official said. “My guess is something went wrong.”

U.S. officials have not commented on al-Shabab assertions that the group was warned of the operation, in which SEALs approached in small boats in the predawn hours to seize Ikrima.

Although there is no public indictment against Ikrima, administration officials expressed confidence that they could have brought charges against him in this country if he had been captured.

The Somalia mission also appeared to indicate an increased U.S. willingness to operate on the ground in Somalia, where al-
Shabab has strengthened its adherence to al-Qaeda’s vision of a global Islamic struggle, even as its capabilities have weakened in its own country.

“The United States has had a general preference for not going kinetic in Somalia,” the former official said. “That’s been clear.”

Pentagon proposals to strike al-Shabab training camps, made within months of Obama’s first inauguration in 2009, were heatedly opposed by the State Department and other national security civilians because the group was “always a hybrid organization in which there was an element of East Africa, of al-Qaeda and foreign fighters, but the large mass of the group was concerned with Somalia issues and had not signed up for the global jihad,” the former official said.

Although the CIA has maintained an active presence in Somalia at various times since the 1994 withdrawal of U.S. forces, who were initially sent there on a humanitarian mission, American military operations there have been few and far between. In 2009, a Special Operations team fired missiles from helicopters to blow up a convoy carrying an embassy bombings suspect, Saleh Ali Saleh Nabhan, near the Kenyan border, then briefly landed to scoop up the remains for DNA identification.

In April 2011, Ahmed Abdulkadir Warsame, an al-Shabab commander thought to serve as a liaison with Yemen-based al-
Qaeda in the Arabian Peninsula, was captured by U.S. forces at sea between the two countries. In June of that year, a U.S. drone strike outside Kismayo killed two al-Shabab leaders also alleged to be active with the Yemen group.

But unlike in Yemen and in Pakistan, where U.S. drone strikes have killed at least 3,000 alleged Islamist militants over the past five years, the U.S. approach in Somalia and North Africa “has been to work through other countries,” said Seth Jones, a counterterrorism specialist at the Rand Corp.

The administration’s counterterrorism guidelines restrict targets of lethal action to those who pose a specific, “continuing and imminent threat” to the U.S. homeland or to Americans. Until recently, few al-Shabab members were considered to fit that definition. And administration officials made clear that the attack on Nairobi’s Westgate mall, although it is frequented by Americans in Kenya, did not fit those criteria.

While the senior official declined to discuss intelligence indicating that Ikrima is involved in specific plots against Americans, “you make a judgment based on the intent, the capability and the active plotting. . . . Some of it is a threat picture, some of it is a specific plot,” the official said. “With a guy like this, it is a mix of all those things.”

Greg Miller contributed to this report.