While Gadhafi tightened his hold on the capital, his forces also made an intensified assault on Zawiya, the closest opposition-held city to Tripoli. At the same time, rebel fighters went on the offensive in central Libya, attacking regime forces at an oil port.
A brigade commanded by his son Khamis battered Zawiya in fierce fighting. The commander of the rebel forces — Hussein Darbouk, a colonel in Gadhafi's army who defected — was shot to death by fire from an anti-aircraft gun, and at least three other rebel fighters were killed in the battle, an opposition activist in the city said.
But the activist, Alaa al-Zawi, and another resident said Zawiya remained in opposition hands. The fighting was raging on the western edges of the city, about 30 miles (50 kilometers) west of Tripoli, where the elite Khamis Brigade attacked in the morning, bombarding with mortars, heavy machine guns and anti-aircraft guns — used frequently as a ground weapon in the conflict.
Zawiya's fighters have beaten back several attacks in the past two weeks by Gadhafi forces trying to re-capture the city.
So far, the Libyan leader's troops has been unable to take back significant ground from the opposition, which has taken over the entire east of the country and several cities in the west near Tripoli. At the same time, his opponents, made up of ragtag citizen militias backed by mutinous army units, have been hesitant to make a military move against territory still in regime hands.
In what appeared to be their first attempt to go on the offensive, rebel fighters attacked a government force at the oil port of Ras Lanouf, 380 miles (620 kilometers) east of Tripoli. The fighters, carrying Kalashnikovs and heavy machine guns, advanced on the port from Brega, an oil facility to the east where only days earlier they repelled an attack by regime forces.
Explosions could be heard, and government forces appeared to be holding their position, witnesses said.
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."
They and others in Tripoli spoke on condition of anonymity for fear they could be hunted down by security forces like other protesters.
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.
Residents say they are under the watchful eyes of a variety of Gadhafi militias prowling the streets. They go under numerous names — Internal Security, the Central Support Force, the People's Force, the People's Guards and the Brigade of Mohammed al-Magarif, the head of Gadhafi's personal guard — and they are all searching for suspected protesters.
"While you are speaking to me now, there are spies everywhere and people watching me and you," one man said, cutting short a conversation with an Associated Press reporter visiting the Tripoli district of Zawiyat al-Dahman on Thursday.
AP correspondent Bassem Mroue in Cairo and AP Technology Writer Barbara Ortutay in New York contributed to this report.