By Maria Golovnina
TRIPOLI (Reuters) - Security forces loyal to Libyan leader Muammar Gaddafi launched an offensive on Friday to retake a town near the capital that has for days been defying his rule, residents said by telephone.
An improvised force of rebels has been pushed back to the central square in Zawiyah, 50 km (30 miles) west of Tripoli, where about 2,000 of them are getting ready to make a last stand, a rebel spokesman said.
"We are on the square, all of our forces are here," said Youssef Shagan. "The square is safe but they (government forces) are attacking from east and west. We will fight until the end."
"They have now started trying to go into the city to try to retake it," he said.
He said three rebel soldiers had been killed and 40 people had been wounded. His account could not be independently verified because reporters' movements in Libya are restricted.
The rebellion in Zawiyah -- the closest rebel-held territory to the capital and also the site of an oil refinery -- has been an embarrassment to the Libyan authorities who are trying to show they control at least the west of the country.
Eastern regions of the country, around the city of Benghazi, have already spun out of Gaddafi's control after a popular revolt against his four decades of rule.
Earlier this week in Martyrs' Square in the center of Zawiyah, re-named in honor of the people killed in the initial fighting that expelled government forces, people threw shoes at posters of Gaddafi.
They showed off a captured armoury of tanks, armoured personnel carriers and anti-aircraft guns mounted on pick-up trucks.
But the town was still encircled by large numbers of government troops and the rebels had been preparing for a major counter-attack, which it appeared on Friday was now happening.
"From 11 a.m. (4 a.m. EST) until now Gaddafi's mercenaries, mainly from Africa, have been opening fire on people here," said a local man called Ibrahim.
"Hundreds of victims are now in the town hospital. It's incredible. We can't let Gaddafi continue massacring his own people. The streets are empty, shops are closed and only cars used by insurgents to transport victims are visible."
"We have no choice but to continue our fight against this dictator," he said.
(Additional reporting by Lamine Chikhi in Algiers; Writing by Christian Lowe; Editing by Ralph Boulton)