TRIPOLI, Libya (AP) -- Moammar Gadhafi's forces launched a powerful attack trying to take back the closest opposition-held city to the Libyan capital on Friday, in fierce fighting that killed at least 18, including the city's top rebel commander - an army colonel who defected. In Tripoli, Gadhafi loyalists fired tear gas and live ammunition to smother a new outbreak of protests.
To the east, rebels advanced on an oil port along the Mediterranean coast in their first offensive against Gadhafi's military. Explosions were heard as the two sides battled around the air strip at Ras Lanouf, residents said.
The fighting underlined how both sides are pushing against the deadlock that has gripped Libya's 18-day-old upheaval. The rebellion has broken away the entire eastern half of the country from Gadhafi's control and has swept over several cities in the west close to the capital.
So far, Gadhafi has had little success in taking back territory, with several rebel cities repelling assaults in the past weeks. But the opposition forces have seemed unable to go on the offensive to march on areas still under. 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 son of Gadhafi who commands it - bombarded the city's western edges with mortars, heavy machine guns, tanks and anti-aircraft guns, several residents said. By the evening, they had also opened a front on the eastern side. Armed Zawiya citizens backed by allied army units were fighting back.
The commander of the rebel forces - Hussein Darbouk - was shot to death 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 army troops in Zawiya early on in the uprising.
A witness who was at Zawiya's hospital said at least 18 people in the city were killed and 120 wounded. Libyan state TV claimed the attackers had retaken the city. But al-Zawi, the witness and other residents said it remained in opposition hands, with skirmishes continuing after nightfall.
They and other witnesses and residents around the country spoke on condition of anonymity for fear of retaliation.
The day's other fighting took place at Ras Lanouf, a small oil port 380 miles (620 kilometers) east of Tripoli, just outside the long swath of eastern Libya controlled by the opposition.
Rebels attacked Ras Lanouf on Friday afternoon, feeling flush with victory after repelling Gadhafi forces who attacked them days earlier at Brega, a larger oil facility just to the east. Fighters armed with Kalashnikovs and heavy machine guns were seen streaming in pickup trucks and other vehicles from Brega heading in the direction of Ras Lanouf.
They battled with about 3,000 pro-Gadhafi troops, mainly around the facility's airstrip, said a resident of the town. She reported heavy explosions starting around 4 p.m. As night fell, the explosions eased, she said, but it was not clear who was in control of the complex, which includes a port and storage facilities for crude coming from fields in the deserts to the south.
The fall of other parts of the country has made control of the capital Tripoli, his strongest bastion, crucial for Gahdafi. His loyalists have taken fierce action to ensure protesters cannot rise up and overwhelm the city as they have in other places.
Last week, Friday marches were met by barrages of gunfire from militiamen shooting into crowds, killing a still undetermined number. Since then, pro-Gadhafi forces have carried out a wave of arrests against suspected demonstrators, snatching some from their homes in nighttime raids, instilling fear in the most restive neighborhoods.
In the latest opposition attempt, more than 1,500 protesters marched out of the Murad Agha mosque after noon prayers Friday in the eastern Tripoli district of Tajoura, chanting "the people want to bring the regime down" and waved the red, black and green flag of Libya's pre-Gadhafi monarchy, adopted as the banner up the uprising.
But pro-Gadhafi forces quickly moved in. They fired volleys of tear gas and - when the marchers continued - opened fire with live ammunition, according to witnesses.
It was not clear if they fired at the crowd or into the air, but the protesters scattered, many of them taking refuge back in the mosque, according to an Associated Press reporter at the scene. A doctor said several people were wounded and taken to a nearby hospital.
"All these people are threatened with death," said a 35-year-old among the Tajoura protesters Friday. "We have no education, no economy, no infrastructure. ... We want nothing but the end of the regime. We were born free but he is suppressing us." He said he had recently had kidney surgery, but "look at me, still I went out with the people because we are oppressed people."
"I am not afraid," said another man in the march. "We want to show the world that we are not afraid."
The fear seemed to have had an impact, and some protests in other parts of the capital didn't get off the ground. One resident said he went to prayers at a downtown mosque and found police officers standing outside to ensure no one marched. After prayers, the worshippers dispersed without protests.
Instead, dozens of Gadhafi supporters turned up for a counterdemonstration in Tripoli's central Green Square, waving green flags.
Before prayers, the worshippers gathering inside the Murad Agha mosque debated what to do. They said messages between Tripoli organizers were being aired on radio being aired from Benghazi, the main city in the opposition-held east, and audible in the capital.
At one point, they decided to hold a sit-in inside the mosque to avoid coming under gunfire by stepping outside. In the mosque's courtyard, they burned a copy of the Green Book, Gadhafi's political manifesto, as well as the green flag of Gadhafi's Libya.
At the same time, young men from the neighborhood transformed a nearby square, tearing down posters of the Libyan leader and replacing them with the flags. They spray-painted walls with graffiti reading, "Down with Gadhafi" and "Tajoura will dig your grave."
In the end, the 400 worshippers in the mosque decided to march, joined by hundreds of others.
Ahead of the planned protests, Internet services, which have been spotty throughout Libya's upheaval, appeared to be halted completely in Tripoli on Friday. Renesys Corp., a Manchester, New Hampshire, company that maps the pathways of the Internet, said it wasn't able to reach any of the websites it tried to access inside Libya on Friday. Google's transparency report, which shows traffic to the company's sites from various countries, also showed that Internet traffic had fallen to zero in Libya.
Libyan authorities briefly barred many foreign journalists from leaving their hotel in Tripoli, claiming it was for their protection because they had information "al-Qaida elements" plan to open fire on police to spark clashes. They later allowed them to go out into Tripoli.
Several hours before prayers, security forces began to take up positions. In Tajoura, police set up two checkpoints on the main highway leading to downtown. They stopped cars to search them, check drivers' ID and ask where they were going or coming from.
Gadhafi loyalists in the capital have unleashed a wave of arrests and disappearances since last Friday's bloodshed. Bodies of people who vanished have been dumped in the street. Gunmen in SUVs have descended on homes in the night to drag away suspected protesters, identified by video footage of protests that militiamen have pored through to spot faces. Other militiamen have searched hospitals for wounded to take away.
AP correspondent Bassem Mroue in Cairo and AP Technology Writer Barbara Ortutay in New York contributed to this report.