Forces loyal to Libya's government have taken control of the former Gaddafi stronghold of Bani Walid, commanders have said, after weeks of fighting that have underlined the weakness of central authority more than a year after Libya's revolution.
Pro-government fighters shouted "Bani Walid is free!" on Wednesday as pick-up trucks mounted with weapons poured into the centre of the isolated hilltop town, one of the last to surrender last year to the rebels who toppled the late Libyan leader.
Thousands of people have fled the bloodshed between rival militias this month, and pockets of resistance were still reported on Wednesday on the outskirts of Bani Walid, about 170km south of Tripoli, the capital.
Bent on making their mark on a town they say still harbours many of Gaddafi's followers, pro-government forces fired rocket-propelled grenades and anti-aircraft weapons at empty buildings.
Heavy gunfire thundered non-stop and smoke billowed over part of the town.
The fighters cried "Allahu Akbar!" (God is Great) and "Today Bani Walid is finished!", honking car horns and blasting patriotic music from their trucks.
Some of them climbed onto the roof of one building in the ghost town to hoist Libya's tricolour flag and then fired their rifles in the air.
Posters of Omran Shaban, a fighter who found Gaddafi hiding in a drainage pipe a year ago, as well as historical Misrata hero Ramadan al-Swehli hung atop one town-centre building.
But next to it, a coffee shop stood empty with its plastic chairs still outside, and residents were notably absent from main streets.
"On this day - Oct 24 - Bani Walid is free. There are no more Gaddafi militias inside," said Fathi Shahoud, a commander of Libya Shield, a grouping of militias operating under the umbrella of the defence ministry.
"Now we control the city and we will stay to ensure safety."
Tarek Nouri Abu-Shabi, a 21-year-old member of the Free Libya militia, said: "The revolutionaries have been in control since yesterday. These are rebels from Misrata, Tripoli and from other places.
"There are still small pockets of fighting on the outskirts. We found weapons inside the town."
Pro-government forces moved on Bani Walid this month after Shaban died following two months of detention in the town.
The standoff highlighted the Tripoli government's inability to reconcile groups with long-running grievances, as well as its failure to bring many of the militias that deposed Gaddafi fully under its control.
The pro-government militias set out to find those suspected of abducting and torturing Shaban, and the national congress gave Bani Walid a deadline to hand them over.
"The military act is now finished. We now are working to make the city stable and more secure," army chief of staff
Youssef al-Mangoush told reporters.
"That doesn't mean that there isn't some resistance here or there. Now the government is in charge."
He said the pro-government forces had freed a number of people from detention and captured some fighters who used to
belong to Gaddafi's son Khamis's brigade.
According to the Libyan state news agency, the clashes in Bani Walid killed at least 22 people and injured hundreds.
Thousands of families fled, saying there was no water or electricity in the city and a shortage of food and medicine.
There were unconfirmed reports on Tuesday of retribution by pro-government forces.
"The militias have entered the suburbs with bulldozers and have begun to demolish homes without reason," Abdel-Hamid Saleh, a member of a Bani Walid civil society group, said by phone.
"A woman called me yesterday screaming 'They have come for me, they have come for me' in fear. The city is falling on our heads."
The Bani Walid General Hospital was evacuated this week when, according to residents, it came under a rocket and mortar barrage.
"The patients have been moved to hiding places, homes and mosques because they were under fire in the hospital," tribal elder Mohammed al-Shetwai told the Reuters news agency.
The International Committee of the Red Cross said it had previously delivered surgical supplies to treat about 100
patients wounded by shooting inside the city, as well as other urgently needed medical supplies.