A Libyan Islamist militia was swept out of the eastern city of Benghazi in a popular protest against the armed groups that ran into the early hours of Saturday morning, Reuters witnesses said.
At least one person was killed and 20 wounded, a hospital source said, as militias tried to fight the demonstrators from a heavily fortified base. Gunfire could be heard in the area before the fighters were forced out.
Looters carried weapons out of the vacated Ansar al-Sharia military base compound as men clapped and chanted, "Say to Ansar al-Sharia, Benghazi will be your inferno."
Ansar al-Sharia has been linked to the attack on the US Consulate in Benghazi last week in which the US ambassador to Libya and three other Americans died. It denies involvement.
The action against the group appeared to be part of a coordinated sweep of militia headquarters buildings by police, government troops and activists following a mass public demonstration against militia units on Friday.
Chanting "Libya, Libya," hundreds of demonstrators entered, pulling down militia flags and torching a vehicle inside Ansar al-Sharia's headquarters in Benghazi –– once the base of forces of former leader Muammar Qadhafi, which tried to put down the first protests that sparked last year's uprising.
The crowd waved swords and even a meat cleaver, yelling "No more Al-Qaeda" and "The blood we shed for freedom shall not go in vain."
"After what happened at the American Consulate, the people of Benghazi had enough of the extremists," demonstrator Hassan Ahmed said. "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 Qadhafi controlled Libya from, and then Ansar al-Sharia took it over. This is a turning point for the people of Benghazi."
Adusalam al-Tarhouni, a government worker, who arrived with the first wave of protesters, said several pickup trucks with the group's fighters had initially confronted the protesters and opened fire. Two protesters were shot in the leg, he said.
"After that they got into their trucks and drove away," he said, adding protesters had freed four prisoners found inside.
As protesters left Ansar al-Sharia's headquarters, the crowd swelled, reaching thousands as it headed toward its military base, which was shared with another militia group.
Protesters said the militiamen opened fire as they arrived and several people were wounded.
"We came as peaceful protesters. When we got there they started shooting at us," student Sanad al-Barani said. "Five people were wounded beside me. They used 14.5 caliber machine guns."
After the crowd entered that compound, Libyan army trucks sped away from the base carrying government troops cheering in victory and crying out, "God is greatest."
Vigilantes armed with machetes and clubs blocked the highway leading away from the compound, stopping cars to prevent looters from driving off with heavy weapons.
"We went into the camp and we didn't find anyone. We just took these Kalashnikovs," said one youth, holding rifles.
The demonstrators also took over a compound belonging to the Abu Salim brigade and another Ansar al-Sharia compound.
Thousands of Libyans had marched in Benghazi on Friday in support of democracy and against the Islamist militias that Washington blames for the assault on its consulate. Hundreds of Ansar al-Sharia supporters held their own protest.
Friday's "Rescue Benghazi day" demonstration called for the government to disband armed groups that have refused to give up their weapons since the NATO-backed revolution last year.
"It's obvious that this protest is against the militias. All of them should join the army or security forces as individuals, not as groups," student Ahmed Sanallah said. "Without that there will be no prosperity and no success for the new Libya."
Although the main demands of the marchers did not mention the attack on the US consulate, it seems to have provided a strong impetus for the authorities to rally support behind the country's weak government.
US Ambassador Christopher Stevens was well liked, and many Libyans condemned the attack on the consulate despite being angered by the anti-Islamic US-made film that triggered it.
Some protesters' placards read: "We demand justice for Stevens" and "Libya lost a friend." Others had mixed views.
"I am out today to defend Benghazi. Killing the ambassador is a completely separate thing," said 26-year-old Amjad Mohammed Hassan, a network engineer. "I don't give a damn about the killing of the ambassador because the Americans offended the Prophet. I am just here for Benghazi."
Benghazi, 1,000 kilometers (600 miles) from Tripoli across largely empty desert, is controlled by various armed groups, including some comprised of Islamists who openly proclaim their hostility to democratic government and the West.
Some are identified by local people as being among those who were at the consulate protest last week. US officials have described the violence as a "terrorist attack."
Abu Al-Qaa, a demonstrator at the Ansar al-Sharia demonstration, said Stevens had been "preparing for the entry of American troops into Libya."
"The will of the Prophet was to expel infidels from Muslim lands so that Muslims prevail. Terrorizing your enemy is one of Islam's tenets." He said he had fought US troops in Iraq where he was arrested, sent back to Libya and jailed for three years.
One banner at the Ansar al-Sharia demonstration read, "Day to rescue Benghazi or day to rescue America?"