The deadly attack on the U.S. Consulate in Benghazi underscores the gaping power vacuum across Libya since the toppling of Moammar Gadhafi's regime last year.
Fighting groups that battled Gadhafi have stepped in to maintain law and order after the fall of the regime, an expert on post-Gadhafi Libya told CNN.
Most of the groups are simply neighborhood watch entities. But some include hard-line Muslim Salafis and have "a very Islamist orientation," said Frederic Wehrey, a senior associate in the Middle East Program at the Carnegie Endowment for International Peace.
The group accused of being behind the consulate assault, the Imprisoned Omar Abdul Rahman Brigades, is said to be pro-al Qaeda.
"The problem is that the Libyan army and the Libya police forces effectively disintegrated," Wehrey said. "These groups are basically running the show" throughout much of Libya.
Another analyst, Andrew Lebovich, a Washington-based researcher focused on security issues in North Africa and the Sahel, said the militias, criminal groups, and hard-line Islamist groups in Libya make up a "somewhat diffuse" environment.
"Some groups, such as the Ansar al-Sharia Brigades in Benghazi and Derna and the Imprisoned Omar Abdel Rahman Brigades have been involved in increasing shows of force and outright attacks against Western and other targets in Libya in recent months," he said.
Wehrey, in speaking to CNN, cited two of his recent essays about security in Libya. One was in Foreign Affairs in July and the other appeared Wednesday on the Carnegie Endowment for International Peace website.
He said the fledgling government is in a bind.
Officials are trying to demobilize and reintegrate the militias and bring these groups into the government security forces, he said.
But the militia members across Libya remain loyal to their groups and distrust the new government's authority, in part because of the "taint" of a link to the Gadhafi regime, Wehrey said.
The government has used militia commanders to quell tribal fighting, subcontracted border control and defense of oil installations to small brigades, and used armed groups to provide security during elections.
In Benghazi, he said, ballots for an election were stored and counted at the headquarters of the city's strongest militia.
"The strategy of trying to dismantle the regional militias while simultaneously making use of them as hired guns might be sowing the seeds for the country's descent into warlordism," he warned.
"It has also given local brigades and their political patrons leverage over the central government. Emboldened by the writ of state authority, brigade commanders have been free to carry out vendettas against rival towns and tribes, particularly those favored by ... Gadhafi," Wehrey said.
Violence between warring militias and attacks against Western and moderate Sufi Muslim targets erupted in recent months, Wehrey said. In Benghazi, there was a "rapid deterioration" of security before the U.S. Consulate attack.
A strike on a British consulate vehicle in Benghazi in June wounded a diplomat.
The International Committee of the Red Cross said its workers endured attacks at least five times in less than three month in Benghazi and Misrata. The group announced the suspension of its activities in August.
The Imprisoned Omar Abdul Rahman Brigades, in fact, first surfaced in May when it claimed responsibility for an attack on the ICRC office in Benghazi. The next month it claimed responsibility for detonating a blast outside the U.S. Consulate in Benghazi. It also released a video of the attack.
Sufi mosques and tombs were among the sites targeted. Sufism is considered a more moderate form of Islam.