Libya conflict: NTC forces claim Bani Walid victory
Fighters with Libya's interim authority say they have raised their flag over Bani Walid, one of the last towns still loyal to Col Muammar Gaddafi.
Military spokesman Ahmed Bani said that 90% of the town had been liberated, including the centre.
Forces with the National Transitional Council (NTC) have besieged Bani Walid for weeks and taken heavy casualties.
Further east, NTC forces are still struggling to overcome loyalists holed up in the centre of Sirte.
The BBC's Wyre Davies in Sirte - Col Gaddafi's hometown - says anti-Gaddafi forces have resorted to firing shells and rockets to suppress the sniper fire stalling their advance.
Most of Sirte's residents have fled.
Speaking in Tripoli, Mr Bani said revolutionary forces in Bani Walid had suffered "heavy casualties" but declined to give a number.
Celebratory gunfire erupted as groups of fighters entered the town. Troops had launched a pincer attack from the north and south which met in the city centre, capturing the castle at the heart of the sprawling oasis town.
Jubilant fighters hoisted the red, black and green flag of the new interim government over mosques and other buildings, tearing down the all-green emblem of the ousted regime.
Witnesses said there was a stench of death hanging over the town's hospital where several decomposed bodies had lain in the mortuary.
The hospital began admitting patients again after a team from the International Committee of the Red Cross arrived with much-needed medical supplies, correspondents reported.
However, there was no electricity and several wards have been gutted by shelling.
Bani Walid, some 170km (110 miles) south-east of Tripoli, was one of Col Gaddafi's bastions where it was suggested he might make a last stand. The ousted leader's whereabouts are still unknown although he is widely believed to be hiding in Libya's vast southern desert.
On Sunday, a pro-Gaddafi TV station confirmed reports that Col Gaddafi's son, Khamis, had been killed in late August.
Arrai television, based in Syria, said he had died during fighting with NTC forces in the city of Tarhouna, 90km (60 miles) south-east of Tripoli.
Khamis Gaddafi has been reported dead twice before since the uprising began, only to reappear.
UK Foreign Secretary William Hague paid a brief visit to Tripoli as part of a regional tour of north Africa on Monday. His main purpose was to re-open the British embassy in the capital and he also met NTC chairman Mustafa Abdul Jalil.
The embassy building, which was ransacked during the conflict, will take two years to be fully repaired.
In Tripoli on Sunday, bulldozers began to demolish Col Gaddafi's fortress-like Bab al-Aziziya compound.
Interim leaders said it was time "to tear down the symbol of tyranny".