Libya's armed forces gave militias 48 hours to withdraw from government installations in and around Tripoli that they occupied after last year's uprising, while two groups announced they were disbanding after weekend protests against them.
The ultimatum issued late on Saturday by the military said authorities would use force if needed to back their mission.
Libya's news agency LNA said the Ansar al-Shariah brigade - linked by Libyan authorities to an attack on the US consulate in the country - and the Abu Selim brigade in the city of Derna, east of Benghazi, announced they would disband "in response to the demands of protesters".
The move, a day after Benghazi residents rebelled against the militias in violence that killed at least 11 people and wounded more than 70, was announced by Mohammed al-Megaryef, head of the national assembly, in the city. It came 10 days after the attack on the consulate in Benghazi - sparked by a US-made film that mocks Islam - left four Americans, including ambassador Chris Stevens, dead on the anniversary of September 11.
The authorities also decided to put in place an "operations room" in Benghazi bringing together the army, forces of the interior ministry, and defence ministry brigades comprising former rebels. They called on the army to impose its authority by putting its own officers at the head of brigades born out of last year's revolt, which escalated into civil war and toppled the regime of Muammar Gaddafi.
The fighting centred at the offices of Raf Allah al-Sahati, a Salafist brigade under the defence ministry, which was looted.
The measures were the outcome of meetings including Prime Minister Mustafa Abu Shagur, army chief Major General Yousef al-Mangush, intelligence services head Salem al-Hassi, and national assembly and local council members.
Hundreds of former rebels have taken over strategic, state-owned military and civilian facilities, as well as the properties of supporters and leaders of the former regime in the wake of its fall.
Six members of the security forces were among those killed in the unrest that rocked Benghazi.
The protesters first attacked the Raf Allah al-Sahati brigade before turning their wrath on the headquarters of Ansar al-Sharia, a radical Salafist militia and the main paramilitary group in the city. Ansar al-Sharia has denied involvement in the murder of the four Americans at the consulate.
The militiamen took flight as hundreds of protesters set their compound ablaze. Demonstrators also evicted them from Al-Jalaa hospital, where they were replaced by military police.
As the violence expanded, Libyan authorities called on the demonstrators to distinguish between "illegitimate" brigades and those under state control, warning that neutralising loyal units risked causing "chaos".
The warning highlighted the dilemma facing the government a year after Gaddafi's overthrow, with the fledgling security forces dependent on former rebels who also challenge the government's authority.
Bloomberg, Agence France-Presse