Several hundred opponents of Libyan leader Muammar Gaddafi spilled out of a mosque in the capital after prayers on Friday and started chanting: "Gaddafi is the enemy of God!"
There was no sign of any security presence at the protest but pro-Gaddafi militias armed with Kalashnikov rifles had set up checkpoints around the neighbourhood, reinforced by armoured personnel carriers.
"This is the end for Gaddafi. It's over. Forty years of crimes are over," said Faragha Salim, an engineer at the protest.
Tripoli is Gaddafi's principal stronghold after large swathes of the country rejected his rule, and the authorities have tried to portray it as a city going about its life as normal, but the protest punctured that image.
In rebel-held Zawiyah, about 50 km (30 miles) west of the Libyan capital, a witness said pro-Gaddafi forces attacked rebel positions to try to stop people attending Friday prayers in the town.
The authorities tried to prevent foreign media from reporting independently on the protests in Tripoli.
Security guards stood in the way when journalists including Reuters reporters tried to walk out of the gates of the media hotel to travel to neighbourhoods in the capital where anti-Gaddafi protests are anticipated.
Officials later allowed them out of the hotel but only if they boarded buses with government drivers who were taking them to locations selected by the authorities.
A revolt against Gaddafi's four-decade rule has left the eastern side of the country, and several towns elsewhere, in rebel control. He is facing international condemnation over the hundreds killed in a crackdown on the revolt.
Residents of Tripoli said before the protests they they anticipate a violent crackdown by armed pro-Gaddafi militias, who have been roaming the city in civilian cars and with scarves wrapped around their heads.
Yousef Shagan, a spokesman for the anti-Gaddafi rebels holding Zawiyah, said the two sides were exchanging fire on the outskirts of the town, and that two fighters loyal to Gaddafi had been killed.
"They attacked because they are trying to prevent people from joining Friday prayers. Gaddafi's soldiers are fighting. Our people have encircled them in western Zawiyah," he said by telephone.
Friday is the day of religious observance in the Muslim world when thousands of men assemble in the mosques to pray and listen to sermons. It can also be a flashpoint for outpourings of anger.
Last Friday, several thousand anti-Gaddafi protesters came out into the streets after prayers. Armed security forces broke up the protests, and there were unconfirmed reports from witnesses that protesters were shot dead.
A Libyan government spokesman said journalists' movements were being restricted because their presence could trigger violence from what he described as affiliates of al Qaeda.
"These are exceptional circumstances. I know you're going to talk about it and twist it the way you want," said the spokesman, Mussa Ibrahim.
"We are preparing to pay this price of preventing you guys from reporting to avoid turning Tripoli into Baghdad."