But the administration does not consider the United States to be at war with every member of the Shabab, officials said. Rather, the government decided that Mr. Warsame and a handful of other individual Shabab leaders could be made targets or detained because they were integrated with Al Qaeda or its Yemen branch and were said to be looking beyond the internal Somali conflict.

“Certain elements of Al Shabab, including its senior leaders, adhere to Al Qaeda’s ideology and could conduct attacks outside of Somalia in East Africa, as it did in Uganda in 2010, or even outside the region to further Al Qaeda’s agenda,” said a senior administration official. “For its leadership and those other Al Qaeda-aligned elements of Al Shabab, our approach is quite clear: They are not beyond the reach of our counterterrorism tools.”

The administration notified the International Committee of the Red Cross of his capture, and a Red Cross representative flew out to the ship and met with him. That visit came about two months after his capture, during a four-day break between his interrogation for intelligence purposes and separate questioning for law-enforcement purposes.

Mr. Warsame was given a Miranda warning — that he had a right to remain silent and to have a lawyer — at the beginning of the second interrogation so that prosecutors would have a better chance of being allowed to use his statements as evidence.

The Obama legal team decided to time the Red Cross visit during the break in order to further emphasize that the second set of interrogators comprised different officials questioning him for a different purpose. That was intended to be able to make the case later to a judge that any subsequent confession was voluntary. (Mr. Warsame waived his rights and continued talking.)

Finally, the administration settled on the civilian trial option because officials did not want to add a new inmate to the Guantánamo prison — which President Obama wants to close — and because a military trial was problematic.

For example, the charges against Mr. Warsame, conspiracy and providing material support to terrorists, are standard criminal charges, but their validity as war crimes is under a cloud.