Hundreds of Libyan protesters have stormed the eastern city of Benghazi and evicted the Islamic militia from their stronghold.

As the protesters working with the military police took over the bases of the extremist groups, four people were killed and up to two dozen injured. Some of the protesters were shot in the leg by the militia.

Reports from the region suggest the militant groups did not go down without fighting. Gunfire was heard before they were flushed out of Benghazi. A vehicle and buildings were also set on fire during the confrontation.

The militant groups stopped firing soon after the Libyan troops arrived.

The protesters stormed the headquarters of the militant group Ansar al-Sharia, the one which is thought to have attacked the US consulate a few days back.

Initially, the group showed resistance to the protesters firing in the air. They fled their headquarters once they were outnumbered by the protesters who shouted slogans such as "no to militias".

The orchestrated eviction of the militia seems to have been a planned operation by government forces and activists.

"I don't want to see armed men wearing Afghani-style clothes stopping me in the street to give me orders, I only want to see people in uniform," a university student involved in the eviction, Omar Mohammed, told the Associated Press.

The protesters thronged Benghazi a day after tens of thousands of protesters demanded putting a full stop to the armed militia.

While officials in the Libyan capital Tripoli have appealed for peace, they urged the protesters to differentiate between armed militant groups and rebel brigades.

"After what happened at the American consulate, the people of Benghazi had enough of the extremists. They did not give allegiance to the army. So the people broke in and they fled. This place is like the Bastille. This is where Gaddafi controlled Libya from, and then Ansar al-Sharia took it over. This is a turning point for the people of Benghazi," a protester Hassan Ahmed told Reuters.

Armed militant groups have a powerful presence in many parts of Libya after the expulsion of former dictator Colonel Muammar Gaddafi.

Libyans wearing traditional clothes and riding horses participate in a protest at a main square in Benghazi - ReutersReuters
Demonstrators chant slogans while carrying banners during a protest in a main square in Benghazi cityReuters
Demonstrators cheer after storming the headquarters of the Islamist Ansar al-Sharia militia group in BenghaziReuters
A file photo of members of Libyan army walking towards one of headquarters of Islamist Ansar al-Sharia militia group to try to break into it in BenghaziReuters
Soldiers stand guard at armed militia base belonging to Islamist Ansar al-Sharia militia group, that they had stormed with pro-government demonstrators in BenghaziReuters
Army members talk as they check an armed militia base they stormed with pro-government demonstrators in BenghaziReuters
Army members check an armed militia base they stormed with pro-government demonstrators in BenghaziReuters
A soldier stands guard at an armed militia base the army stormed with pro-government demonstrators in BenghaziReuters
Demonstrators carrying guns celebrate after burning a car they say was full of ammunition as they stormed the headquarters of the Islamist Ansar al-Sharia militia group in BenghaziReuters
Demonstrator stands next to a burning car after protesters stormed the headquarters of the Islamist Ansar al-Sharia militia group in BenghaziReuters
Demonstrators break into the rooms of the headquarters of the Islamist Ansar al-Sharia militia group in BenghaziReuters
Protesters take part in a march in Benghazi cityReuters
A protester holds his daughter surrounded by army soldiers as they attend a march in Benghazi cityReuters