The Libyan capital saw its first major gunbattle since Moammar Gadhafi fled Tripoli more than two months ago, as his supporters traded fire with revolutionary forces after a crowd raised the ousted regime's green flag.
Fearing more attacks, anti-Gadhafi fighters set up checkpoints manned by young, armed men across the metropolis of some 2 million people, snarling traffic. They also rounded up several suspected African mercenaries, pulling them from cars and houses.
Friday's violence in Tripoli and fierce resistance on two other fronts set back the new rulers' stated goals of declaring total victory and establishing democracy as Gadhafi, the ruler for nearly 42 years, remains on the run.
The capital has been relatively calm since then-rebels swept into the city in late August. But Gadhafi's loyalists have control of parts of his hometown of Sirte and the desert enclave of Bani Walid and have fought off NATO-backed revolutionary forces besieging them for weeks. Gadhafi has tried to rally his supporters with several audio recordings issued from hiding.
The firefight in Tripoli began after Friday prayers. Witnesses said dozens of loyalists carrying the green flag appeared on a square in the Abu Salim neighborhood, which has long been a pro-Gadhafi stronghold and houses a notorious prison of the same name.
"I looked out of my window and I saw men and women in a group of 50 to 80 people, carrying the green flag," said Abadi Omar, a resident in one of the buildings in the area. "They put one of these flags at the end of our street. This is when the revolutionary forces came out and these people disappeared."
Revolutionary forces started searching every building in the area and found weapons on some of the rooftops, many hidden under water tanks, Omar said. Then pro-Gadhafi snipers opened fire, and the gunbattle began as anti-Gadhafi fighters chased loyalists around the closely packed buildings.
In amateur video shown to The Associated Press, gunfire can be seen coming from the upper floors of apartment buildings surrounding the square, prompting revolutionary forces to scramble and begin shooting from the street below.
Shouting "God is Great," hundreds of revolutionary fighters converged on the area in pickups mounted with weapons. They set up checkpoints as heavy gunfire echoed through the streets.
Ameena Sami, a 39-year-old resident, said her brother was shot in his waist.
"My brother was standing at the front door of our house, and we heard shooting in the streets. We don't know where it came from, and the revolutionaries came speeding onto our street and surrounded one of the buildings across the street," she said. "The shooting just got more intense, and we looked outside and found my brother shot."
Tripoli military officials said 12 suspected Gadhafi supporters were detained but played down the shooting, saying no clashes occurred and that the gunfire was primarily from revolutionary forces themselves. The local military council issued a statement saying 30 people were injured in friendly fire.
U.S. State Department spokeswoman Victoria Nuland also downplayed the seriousness of the fighting, calling it an "isolated, relatively small incident, by the sound of it."
Ahmad al-Warfly, a fighter from the revolutionary forces' Zintan brigade, said several Gadhafi supporters apparently planned a protest but drew fire because they were armed. They then fled and were pursued by revolutionary forces, prompting fierce street battles.
Al-Warfly said one man carrying a gun was captured and identified as a suspect wanted for the killings of protesters in the nearby city of Zawiya.
"It seems like it was organized," he said. "They were planning to have a big demonstration, then the fight started."
Witnesses also reported fighting elsewhere in the capital, but the shooting was most intense in Abu Salim.
Interim leader Mustafa Abdul-Jalil, the head of the governing National Transitional Council, has said that he hoped to declare liberation this week after the imminent fall of the holdout city of Sirte, 250 miles (400 kilometers) southeast of Tripoli on the Mediterranean coast. That could allow the council to name a new interim government and set a timeline for holding elections within eight months.
The revolutionary forces control much of Sirte after launching a major push a week ago.
On Friday, they pounded loyalists holed up in two neighborhoods with rocket and machine-gun fire but also suffered heavy casualties themselves. Wounded men streamed into front-line medical units, then were evacuated to field hospitals on the city's outskirts.
Tanks and weapons-mounted vehicles from the revolutionary forces have kept up a steady barrage of fire into the small enclave known as District 2, where commanders believe several hundred remaining loyalists, possibly including high-ranking figures from the former regime, are hiding.
AP Television footage on Friday showed smoke rising from a building in one part of the city, and a burning car presumably in another. Pickup trucks with mounted machine guns are seen driving through a flooded street, and elsewhere an wounded revolutionary soldier is carried on a stretcher into an ambulance.
Thousands of civilians have fled the city to escape the violence.
One resident returned Friday to collect personal items from his home, which had been used as a firing position for pro-Gadhafi forces. Their uniforms and mattresses littered the front courtyard.
The owner, who would not give his name because of fear of reprisals, left carrying just a blanket, saying, "the pictures speak for themselves." He then left the city with several of his relatives.
NATO has called the continued resistance by Gadhafi forces in Sirte "surprising," as they appear to be losing the battle since revolutionary forces have the area surrounded.
In Geneva, meanwhile, a senior U.N. human rights official, Mona Rishmawi, expressed concern about a risk of serious abuses against suspected loyalists after Gadhafi's last strongholds fall to revolutionary forces.
Rishmawi, who recently visited Libya as part of a U.N. delegation, said the transitional government is trying to ensure that the rights of captured Gadhafi fighters are protected but "the system that is currently in place is not adequate."
She said "there is a lot of room for abuse" of the estimated 7,000 people detained in sometimes makeshift prisons throughout Libya.
Associated Press writer Christopher Gillette in Sirte contributed to this report.