Libya's military chief of staff resigned Sunday after 31 people were killed in clashes between a militia group and protesters in the eastern city of Benghazi, the official Libyan News Agency (LANA) reported.
The country's parliament, the National Congress, approved the resignation of General Youssef al-Mangoush at its evening session, LANA said.
Before resigning, al-Mangoush issued orders for the military to take over the headquarters of the militia at the centre of Saturday night's clashes.
Army and air force divisions would take control of facilities from four brigades of the Libya Shield in Benghazi, a spokesman told LANA.
Thirty-one people were killed and dozens injured after protesters gathered outside one of the group's offices demanding that it hand over its weapons and be disbanded.
The fighting ended after Libyan Special Forces took over the headquarters. Five army personnel were among those killed.
Libya's new rulers have been struggling to assert their authority and re-establish security in the North African country since Moamer Gaddafi's overthrow in 2011.
The Libya Shield was made up of former rebels, who became affiliated with the Defence Ministry after the conflict ended.
Benghazi, the birthplace of the anti-Gaddafi uprising, has seen several deadly clashes and blasts in recent months, as militias who joined the 2011 conflict have yet to lay down their weapons.
An explosion near a children's hospital in Benghazi killed three people in May, after armed groups besieged government buildings in Tripoli to call for officials linked to the regime of Gaddafi to be barred from government posts.
US ambassador to Libya Christopher Stevens and three other Americans were killed in September at the mission in Benghazi.