Tension was palpable in Libya's capital on Thursday, a day after deadly fighting between groups of ex-rebels highlighted the lack of security nearly two years after dictator Moamer Kadhafi fell.
Following Wednesday's clashes near central Tripoli, Prime Minister Ali Zeidan said on Thursday that his defence minister would be replaced.
Much of the recent unrest has centred on the eastern city of Benghazi, cradle of the 2011 uprising against Kadhafi, where attacks blamed on Islamists have targeted authorities and Western interests.
But it now seems to be spreading to Tripoli, where brigades of ex-rebels remain entrenched despite government efforts to disarm them.
Since the fall of Kadhafi's regime, militia groups, mostly ex-rebels, have managed strategic facilities.
From different parts of Libya, different tribes and with varying ideologies, they have received official salaries and perks, and some have even engaged in smuggling and extortion.
This week's violence has epitomised the sense of lawlessness.
A group of armed men from the city of Zintan who had been guarding oil facilities in the southern desert attacked the Tripoli headquarters of the petroleum industry security force on Tuesday.
They had been replaced by another group and wanted their jobs back.
Another "brigade" of ex-rebels, loosely attached to interior ministry's top security commission, intervened in the fighting. Five people were killed and five Zintanis captured.
On Wednesday, armed Zintanis attacked the Tripoli headquarters of the brigade in the Abu Slim district, ransacking it and freeing their comrades.
Five people were also killed in that fighting and another 97 wounded, the health ministry said.
The interim head of the army, General Salem al-Konidi, said "we tried to intervene, but our resources did not allow it".
"The government refuses to equip the army," he told Al-Ahrar television.
On Thursday, military police remained deployed along the airport road near Abu Slim.
While there were no outright threats, residents feared there could be more inter-militia clashes.
Signup to our newsletter and follow us on Facebook and Twitter!
Konidi also disowned the Zintanis, who are officially attached to the defence ministry, saying "forces that don't follow our orders don't belong to us".
The government issued a statement overnight regretting the "deplorable acts" and said it would enforce its decision to remove "illegal militias" from the capital.
That decision had been taken by the General National Congress (GNC), the country's highest political authority, after deadly fighting in Benghazi three weeks ago.
On Thursday, Zeidan announced Defence Minister Mohammed al-Barghathi was to go, and said he would name a replacement.
"Members of the Congress asked the defence minister to resign or leave office," Zeidan said in a speech.
"The defence minister will be thanked and we are going to name a new minister."
Barghathi had already announced his resignation on May 7 before withdrawing it again just hours later at Zeidan's request.
Zeidan also called for "draconian and drastic measures to disarm the civil population" after Wednesday's "painful events".
While violence hit Tripoli, there were also deadly attacks elsewhere.
Overnight, three car bombs exploded in Sebha, 700 kilometres (430 miles) south of the capital. Two people died and 17 were wounded in the blasts, which came at roughly half-hour intervals, officials said.
And in Benghazi on Wednesday, an army officer died after a bomb in his official vehicle exploded.
The death of Lieutenant Colonel Jemaa al-Misrati came a day after gunmen killed six soldiers at a checkpoint south of Sirte, the late Kadhafi's hometown.
Libya's new authorities are battling to establish military and security institutions capable of restoring law and order and state authority in the face of armed militias.
In the process, the revolutionaries who were heroes in 2011 are now a thorn in the country's side because they do not hesitate to resort to violence to defend their existence and their interests.
And that extends to turning their sights on the authorities whenever they attempt to turn off the tap.
A large part of the population rejects the permissiveness of the authorities and their alliance with militias.
As the latest violence unfolded, the GNC elected a new head, Nuri Bousahmein, to replace Mohamed Megaryef, who stepped down after a law was passed banning from politics officials of the former regime.
Ironically, while having served as Libyan ambassador to India in the 1980s, Megaryef defected and became a leader of the exiled opposition for three decades.
Bousahmein will be tasked with leading Libya toward new general elections, based on a new constitution that will spell out what political model the country will follow.