Angry protesters set fire to buildings at the Benghazi base of a militia blamed for the death of US ambassador Chris Stevens Reuters

Fierce fighting broke out on Friday night after crowds trying to storm the Benghazi base of a militia blamed for the death of US ambassador Chris Stevens came under fire.

Earlier in the evening protesters calling for an end to militia rule had stormed the headquarters of the Islamic Ansar al-Sharia brigade in the city, setting fire to buildings after pushing past guards who fired in the air.

But the protesters ran into a hail of fire when they moved south to storm a much larger secondary base of the militia, whose members are accused of the attack on the US consulate that left Stevens and three other diplomats dead.

Machine-gun fire burst out as the demonstrators tried to enter the compound, a former base of Muammar Gaddafi's regime.

Later there was pandemonium as police and army vehicles jostled with civilian cars and ambulances trying to get the wounded through traffic to hospital.

Sirens, screams, car horns and the rattle of heavy machine-gun fire filled the air, with long bursts of fiery red tracer fired from inside the base going over the heads of panicked protesters.

Hours earlier, Benghazi had been quiet, its people toasting the peaceful end of a rally that saw 20,000 people gather in the city centre to demand an end to militia violence.

As the women and children left the rally, hundreds of young men stormed the Ansar al-Sharia base, and that of another city centre militia blamed for thuggery, meeting little resistance.

Live television pictures showed wounded men arriving in the city hospitals, some of the lesser wounded shouting Allahu Akbar – God is great.

A Guardian correspondent trying to approach the base was turned back by a bearded man in a long white coat traditionally worn on Friday, the day of prayer.

"You must go back, you must go back, foreigners are not safe," he said.

The decision by the Ansar al-Sharia brigade to fight back rather than surrender its base has caused an immediate political crisis for Libya's head of state, Mohamed al-Magariaf, who has blamed the unit for involvement in the death of Stevens and linked it to al-Qaida.