Libyan protesters ousted a jihadist militia from its headquarters and seized a raft of other paramilitary bases in second city Benghazi early Saturday in heavy clashes that left four people dead. The seizure of the headquarters of Ansar al-Sharia -- which has been accused of, but denied, involvement in the murder of US Ambassador Chris Stevens and three other Americans last week -- came after tens of thousands took to the streets on Friday to protest against the power of the militias. The group's members took flight as hundreds of protesters stormed and then torched its compound, and also evicted it from the city's Al-Jalaa hospital, where they were replaced by military police, an AFP correspondent reported. But to the alarm of senior officials, the demonstrators also stormed a raft of other paramilitary bases in the city controlled by former rebel units that had declared their loyalty to the central government. It was at one such base -- the headquarters of the Raf Allah al-Sahati Brigade, an Islamist unit under the authority of the defence ministry -- that the four people were killed in clashes between its fighters and hundreds of protesters, some of them armed.Another 40 people were wounded in the pre-dawn fighting at the base in a farm in the Hawari district on the outskirts of Benghazi, hospital records showed. Worried Libyan authorities called on the demonstrators to distinguish between "illegitimate" brigades and those who are under state control, warning that the neutralisation of loyal units risked "chaos". The warning highlighted the dilemma facing the Libyan government a year after the overthrow of veteran dictator Moamer Kadhafi -- while militias pose the biggest threat to its authority, its fledgling new security forces are dependent on former rebel units that fought in the uprising. The trigger for the assault on the paramilitaries was a "Save Benghazi" protest after the main weekly Muslim prayers on Friday that was joined by some 30,000 peaceful demonstrators. It drowned out a smaller rally attended by just a few hundred people called by the jihadists and hardline Islamists angry over a US-made film that mocks Islam and cartoons of the Prophet Mohammed published by a French magazine.Demonstrators paid tribute to Ambassador Stevens and the other Americans killed in the September 11 assault on the US consulate in the city that Washington now says was a "terrorist" attack. "Libya lost a friend," read one banner. "We want justice for Stevens," said another. Jihadist militants of Ansar al-Sharia fired in the air as they retreated from their headquarters in the face of the overwhelmingly superior numbers of the protesters. The militia, which rejects Libya's new-found democracy, refuses to join the new national security forces. "This brigade was a big problem for us and for everybody. It was a centre of extremists," said one demonstrator, Tawfik Mohamed, 32. But the protesters, angry at the power in the city of a raft of former rebel groups with varying degrees of loyalty to the central government, also stormed other paramilitary bases.Some 70 demonstrators took over the barracks of the Martyrs of Abu Slim Brigade, while others expelled militiamen from at least four public buildings, before some of the protesters moved on the Raf Allah al-Sahati Brigade base on the city's outskirts. The two sides gave conflicting accounts of what sparked the deadly two hours of rocket and light arms exchanges that culminated in the brigade's fighters pulling out and the attackers looting the base and seizing weaponry early Saturday. "We came peacefully and asked them with our loudspeakers to disarm," said protester Nasser Saad, stressing that armed reinforcements only came after the demonstration was attacked. But one of the brigade's fighters, Ahmed Faraj, insisted that the goal of the attackers was not the suppression of militias but the seizure of the base's armoury. "They were coming to take our weapons," he said. "We are part of the ministry of defence, we fought in the revolution, we can't just walk away and hand over heavy weapons to a bunch of drunks and criminals." National assembly chief Mohamed al-Megaryef, who had initially welcomed the Benghazi protest, urged the demonstrators to withdraw from the bases of loyal brigades. He named Raf Allah al-Sahati and February 17 Brigades, and Shield Libya. Libya specialist Jason Pack said that the scale of the anti-militia protest in Benghazi showed the "depth and breadth of support for the United States that prevails in Libya in the wake of the attack on Ambassador Chris Stevens. "Now with the people calling for a hardline anti-militia policy, Libyan leaders may find themselves steeled with the requisite courage to purge these groups from the Libyan body politic," Pack said.