Rebels in Libya say they have repelled an attempt by government forces to retake the key city of Zawiya, just 50km (30 miles) west of Tripoli.
Following heavy fighting on Saturday morning, government forces were pushed out of the city centre, though recent reports suggest they have regrouped and may be preparing for a fresh assault.
The number of casualties is unclear.
Meanwhile, rebels fighting Col Muammar Gaddafi have taken control of the port of Ras Lanuf to the east of Tripoli.
Observers say the overall balance of power is difficult to assess as the struggle for control over Libya continues.
In Tripoli, there is an air of growing confidence among regime loyalists as their control appears to be consolidated in Tripoli and other central areas, our correspondent there says.
But elsewhere, correspondents say rebel forces have an enormous determination to overthrow his regime.
Gaddafi troops 'flee'
Reports from Zawiya said the town had come under attack from both east and west from well-armed government forces.
Zawiya resident and rebel supporter Mohammed told the BBC that pro-Gaddafi troops "came from east and west and they took up positions in high-rise buildings... and started shooting", Mohammed said.
"Some tanks went to the square and were captured and burnt. There were some casualties among Gaddafi's troops and our troops - but Zawiya was never captured by Gaddafi's troops, this is confirmed.
"I am outside the square, Gaddafi's troops are nowhere to be seen, they have all fled," he told the BBC, to the sounds of rebels singing celebratory songs in the background.
Another Zawiya resident, Hussein, told the BBC that government forces had indeed been driven back.
But he said it followed a "big fight", in which there were many civilian deaths including women and children.
"There are people dying everywhere. It is a disaster what is happening in Zawiya. We really need some help," said Hussein. A doctor in the city quoted by AFP news agency said he knew of seven dead, while other residents estimated that at least 30 people had died.
But both Mohammed and Hussein said they feared another government assault - and reports confirmed pro-Gaddafi forces were a few kilometres from the city centre, apparently circling it in preparation for a fresh attack.
In Ras Lanuf, an oil port east of Sirte - a key Gaddafi stronghold and his hometown - fierce fighting was also reported, with the sound of multiple explosions and heavy artillery.
But a BBC correspondent who reached the town on Saturday morning said rebels had now taken control of the town.
Pro-Gaddafi forces who had been in the town were believed to have moved about 40km (25 miles) to the west.
Pro-Gaddafi forces withdrew to Ras Lanuf two days ago after a battle a little further east in Brega.