Speaking on the sidelines of an economic conference in Indonesia on Monday, Secretary of State John Kerry defended the capture of Abu Anas, saying it complied with American law, The Associated Press reported. Mr. Kerry said the suspect was a “legal and appropriate target” for the United States.

Image Nazih Abdul-Hamed al-Ruqai, who is also known as Abu Anas al-Libi.

The raid tests the ability of the fledgling Libyan government to weather the furor. Indeed, American officials said the Libyan authorities, in a shift, were willing to tacitly support the raid as long as they could protest in public. But it may also have represented a recognition that the interim government was already losing control over the country. It has been unable to finalize a system to elect a constitutional assembly, to ensure the flow of oil that is the lifeblood of the Libyan economy, and even to protect its own government buildings from periodic siege by armed militias.

On Sunday, government officials and large crowds of mourners turned out to bury 15 soldiers gunned down a day earlier at a checkpoint southeast of Tripoli. The reasons for the gun battle were unclear, but the large number of dead soldiers stoked fears of a collapsing state.

The streets of Tripoli were quiet on Sunday night, with no major protests against the arrest or attacks on American interests. But in just a few hours about 2,000 Libyans had signed into a new Facebook page proclaiming solidarity with Abu Anas, who was born Nazih Abdul-Hamed al-Ruqai. “We are all Nazih al-Ruqai, O America,” it was called.

One comment read: “The real Libyan hero rebels should kidnap an American in Libya to negotiate for our brother Ruqai’s release. It is a shame on us and all Libyans. The Americans entered Tripoli with their commandos and they kidnapped our son while we were standing watching.”

Many of the comments were opposed to Abu Anas, however.

Sheik Abu Sidra, a member of Parliament from Benghazi, said lawmakers would summon the prime minister, Ali Zeidan, and other top officials to testify about whether they had prior knowledge of the raid, noting that Mr. Zeidan had recently visited the United States.