TRIPOLI, Libya -- One of Libya's highest military officers resigned Sunday after clashes between protesters and a government-aligned militia he was in charge of left 31 people dead in the eastern city of Benghazi, the deadliest such violence in a country where armed factions hold sway.
The bloodshed underscored the growing public anger over the government's failure to build an army capable of reining in the militias that dominate parts of the country nearly two years after the fall of Moammar Gadhafi. The militias have become bolder in trying to shape Libya's politics.
The violence erupted Saturday when protesters in Benghazi, the country's second largest city, stormed the main camp of Libya Shield, a largely Islamist grouping of militias that are paid by the government to help maintain security. The protesters were demanding that the militias submit to the full authority of Libya's security forces or lay down their arms.
The clashes prompted Army Chief of Staff Maj. Gen. Youssef al-Mangoush to resign, citing the unusually high death toll from the violence. Gen. Mangoush was due to be replaced soon, and the country's Congress voted in support of accepting his resignation Sunday.
He was in charge of the country's roughly 12 Libya Shield brigades, tasked with putting them on government payroll and directing them.
The brigades, though sanctioned by the state, operate as a parallel security structure to the country's police and armed forces. Libya Shield members are neither entirely under the authority of the state nor operating entirely renegade.
Libya's nascent police and military rely on the brigades to help with security of the country. The militias are rooted in the brigades of rebels who fought to oust Gadhafi in the 2011 uprising against the longtime leader. They have since mushroomed in power and size as the government continues to struggle to build its security forces after the civil war.
In the weeks leading up to Saturday's incident, military officers had been protesting Gen. Mangoush, accusing him of corruption and of failing to exert authority over militias. Some militias were believed to have favored him remaining in his post, because he had been unable or possibly unwilling to replace them with a strong unified force.
The militias, many of them refusing to join the army until ministries are purged of former regime officials, are seen by some as exhibiting too much autonomy, according to Frederic Wehrey of the Carnegie Endowment for International Peace.
"Local residents are upset from the sort-of parasitic nature of these militias," said Mr. Wehrey, who was recently in Benghazi. "I think some of these Shield forces were trying to help police in the east, but were leveraging their firepower to try and get concessions from the government."
Benghazi, the birthplace of the revolution that led to Gadhafi's capture and killing, was the site of the Sept. 11 assault last year on the U.S. diplomatic mission that killed Ambassador Chris Stevens and three other Americans.
High level police officials have also been assassinated and security bases have come under frequent attack there by unidentified assailants.
In Saturday's clashes, witnesses said hundreds of protesters -- some of the armed -- marched on the Libya Shield's base, apparently outnumbering the militiamen inside.
It remains unclear which side fired first in Saturday's incident. Libyan officials have provided few details of the clashes.world