At least 32 people were killed and almost 400 wounded in gun battles between Libyan militiamen and armed residents in Tripoli on Friday in some of the worst street fighting in the capital since the overthrow of Muammar Gaddafi.
Prime Minister Ali Zeidan is struggling to control rival militias, Islamist militants and other former fighters who refuse to surrender their arms two years after helping to oust Gaddafi in a NATO-backed revolt.
After Friday's violence, Zeidan demanded that all militias "without exception" leave Tripoli, but the clashes underscored how little his fledging military can do to curb ex-rebels, who have also shut down Libya's oil exports for months.
Friday's bloodshed began when militiamen from the city of Misrata fired at about 500 protesters demanding their eviction from the capital after they had fought rivals for control of city districts.
A Reuters reporter saw an anti-aircraft cannon firing from the "Gharghur brigades'" gated compound into the crowd as protesters chanted: "We don't want armed militias!"
Demonstrators, some of which had been carrying white flags, fled but then returned, heavily armed, to attack the compound, where the militiamen remained holed up until early morning as fighting continued. Rocket-propelled grenades could be heard.
Dozens of soldiers in trucks tried to separate the sides, and sealed off roads to stop more people joining the clashes.
Heavy smoke could be seen rising from the scene in the Gharghur district, where many of Gaddafi's closest collaborators used to live before the uprising.
At least 32 people were killed and 391 wounded, a Health Ministry official said. A Reuters reporter saw the dead body of a girl, aged around 12, whose head had been almost blown off.
Zeidan denounced the killing of protesters. "The demonstration was peaceful and had been permitted by the Interior Ministry, and then the protesters were fired on when they entered the Gharghur district," he said.
'Armed groups must leave'
"The exit of armed groups from Tripoli is not something up for debate but necessary and urgently needed," he told Reuters TV and the Libya Ahrar channel in an interview. He did not elaborate.
Libya's turmoil and the weakness of its border controls are worrying its North African neighbours. France this week said it was considering offering more counter-terrorism training and aid to help Libya prevent militancy spilling over its frontiers.
The French intervention in neighbouring Mali this year drove some Islamist militants with links to al Qaeda across the border into Libya's lawless southern deserts, where the central government has little or no say.
So far, the capital has been spared the almost daily bombings and killings that plague Libya's second city, Benghazi, in the east. But when clashes between rival militias do break out, the nascent armed forces are no match for them.
The Misrata gunmen had fought twice last week with a rival group that had detained one of their members for driving a car without number plates.
On Friday, air force planes circled overhead during the clashes. "We want to make sure the militia don't bring in any reinforcements," said army spokesman Ali al-Sheikhi.
Pro-government militias set up checkpoints on the coastal road outside Tripoli to Misrata to prevent fighters entering Tripoli.
Strikes and armed protests around the country by militia and tribal gunmen demanding payments or more autonomy rights have also shut much of the OPEC member's oil output, depriving the government of its main source of income.
The authorities have tried to defuse the threat of the militias by placing them on the government payroll and assigning them to provide security.
But the gunmen often remain loyal mostly to their own commanders and fight for control of local areas, especially their weapons or drug smuggling rackets, or to settle personal feuds.
Zeidan was himself briefly abducted in October by a militia group on the government payroll.