By Maria Golovnina
ZAWIYAH, Libya (Reuters) - Rebels holding the Libyan city of Zawiyah repelled two attacks on Saturday by forces loyal to leader Muammar Gaddafi using tanks and artillery to retake the strategic town near the capital.
In a second day of fierce fighting for control of the coastal town, 50 km (30 miles) west of Tripoli, government forces retreated to the outskirts early in the day but later mounted a counter-offensive.
Rebels said both attacks were repelled. The city bore the signs of heavy fighting, with one building completely burned and smoldering rubble littering the center.
Other buildings around the main square, the stronghold of rebel resistance, were riddled with holes from large-caliber weapons.
The atmosphere was tense and the situation appeared fluid as rebels braced for more attacks.
"After the morning attack they attacked again. They entered from the west and started shooting rockets at buildings in the square," rebel spokesman Youssef Shagan said.
"We are in a good position. ... They will attack again at night, we think."
A doctor in Zawiyah said at least 30 people, mostly civilians, had been killed during fighting in the day, bringing to at least 60 the death toll from two days of battles.
In the central square four graves had been freshly dug. The red, green and black flag of the rebellion flew from many buildings in the square, where rebels shouted anti-Gaddafi slogans atop tanks and armored personnel carriers captured from the army.
Swabs of blood stained the pavement and spent machinegun and AK-47 shells littered the square.
Dozens of rebels armed with rifles manned rooftops, watching nearby streets from behind piles of sandbags. Roads and sidestreets were barricaded with rebel checkpoints.
In the square, rebels showed a charred tank they had captured from government forces earlier in the day. It was hit by a rebel rocket-propelled grenade as Gaddafi forces tried to enter the square earlier, rebels said.
"The fighting has intensified and the tanks are shelling everything on their way. They have shelled houses," resident Abu Akeel said by telephone, speaking of the afternoon attack.
"Now they are shelling a mosque where hundreds of people are hiding. We can't rescue anyone because the shelling is so heavy."
Outside the city, cars loaded with suitcases and boxes piled on their roofs could be seen driving westward toward Libya's border with Tunisia as refugees continued to flee the violence.
Residents said it was difficult to say how many people were killed in two days of fighting.
A government spokesman could not be reached for a comment.
"They took away many bodies of injured and killed civilians," Lutfi, a local civilian who was helping treat the wounded at a local clinic. said. "I saw that. They were putting them in trucks."
Residents said Gaddafi forces stormed into some residential buildings and killed people inside their houses in order to secure sniper positions on rooftops.
"When we refused to allow them in, they killed my brother and they also killed my cousin," said Waleed, who gave only his first name.
"They slaughtered people," another resident, Abu Mohamad, said. "But we tell Gaddafi that every time a martyr falls, there will be 10 to replace him."
The noise of loudspeakers calling on rebels to keep on fighting could be heard through the telephone.
Rebels fighting Gaddafi's four-decade rule in Zawiyah said they had captured two tanks and three armored personnel carriers from the army.
Inside a building which has served as the rebel central command in the town, the rebels presented six men they said were captured Gaddafi militia fighters.
Two of them were badly wounded, with one standing in a pool of his own blood which was dripping from his thigh.
They waited in silence, looking terrified as the rebels looked through their identification papers.
(Additional reporting by Mariam Karouny in Tunis and Shaimaa Fayed in Cairo; writing by Maria Golovnina and Silvia Aloisi; editing by Michael Roddy)