The bloodshed signaled an escalation in efforts by both sides to break the deadlock that has gripped Libya's 18-day upheaval, which has lasted longer than the Egyptian revolt that led to the ouster of President Hosni Mubarak and inspired a wave of protests across the region.
So far, Gadhafi has had little success in taking back territory, with several rebel cities repelling assaults and the entire eastern half of the country under rebel control. But the opposition forces have seemed unable to go on the offensive to march on pro-Gadhafi areas.
Meanwhile, in Tripoli — Gadhafi's most important bastion — his loyalists have waged a campaign of terror to ensure that protesters do not rise up in significant numbers.
Friday's assault on the rebel city of Zawiya, about 30 miles (50 kilometers) west of Tripoli, appeared to be the strongest yet by Gadhafi's forces after repeated earlier forays against it were beaten back.
In the morning, troops from the elite Khamis Brigade — named after the Gadhafi son who commands it — bombarded the city's western edges with mortar shells, heavy machine guns, tanks and anti-aircraft weapons, several residents said. By the evening, another brigade had opened a front on the eastern side. Armed Zawiya citizens backed by allied army units were fighting back.
The commander of the rebel forces — Col. Hussein Darbouk — was killed by fire from an anti-aircraft gun, said Alaa al-Zawi, an activist in the city. Darbouk was a colonel in Gadhafi's army who defected along with other troops in Zawiya early in the uprising.
A witness in Zawiya's hospital said at least 18 people were killed and 120 wounded. Libyan state TV reported the attackers had retaken the city. But al-Zawi, the witness and other residents said it remained in rebel hands, with skirmishes continuing after nightfall.
A doctor on the scene said pro-Gadhafi fighters would not allow medics to treat the injured, opened fire on ambulances trying to assist and hauled away the bodies of some of the dead in an apparent effort to keep death toll reports low. The gunmen killed a wounded rebel with three shots as a medic tried to pull him to safety, then even threatened to shoot the medic, the doctor said.
The doctor and witnesses spoke on condition of anonymity for fear of retaliation.