The protesters apparently threw stones at the police and set fires in the streets.

Al Jazeera's Alireza Ronaghi, reporting from Tehran, said that the protests had largely been quelled by Saturday evening.

"The presence of security forces were very high, they definitely wanted to take back the streets of Tehran ... right now I don't expect that many protesters are concentrated anywhere in Tehran," he said.

He said that state television had quoted the head of Iran's police force as thanking the Iranian people for not taking to the streets and taking the police warnings seriously.

As the clashes took place, a suspected suicide bomber blew himself up outside the shrine of Ayatollah Ruhollah Khomeini, the leader of the Islamic revolution in 1979, injuring at least two people, local news agencies reported.

As night fell, the protesters kept up their show of defiance shouting "Allahu Akbar" (God is greatest) from the rooftops, a deliberate echo of a move made during the Islamic revolution in 1979.

Barack Obama, the US president, condemned the violence and urged Tehran to allow Mousavi's supporters to stage peaceful protests.

"The Iranian government must understand that the world is watching," he said.

"We mourn each and every innocent life that is lost. We call on the Iranian government to stop all violent and unjust actions against its own people."

"He's putting the blame for the violence squarely on the Iranian government saying that the world is watching what is going on in Iran, not just that the United States is watching

"Basically he is calling the whole world as a witness to what's going on in Iran.

"He's trying to make this not an Iran-America thing, but a global human rights argument that he's putting to the leaders of Iran."

'Ready for martyrdom'

In a statement posted on the website of his Kalemeh newspaper, Mousavi repeated his demand for the elections results to be annulled and hit out at a speech by Ayatollah Ali Khamenei, Iran's supreme leader.

"If this huge volume of cheating and changing the votes ... which has hurt people's trust, is presented as the very evidence of the lack of cheating, then it will butcher the republican aspect of the system and the idea that Islam is incompatible with a republic will be proven," he said.

Anoushka Marashlian, an independent Middle East analyst, told Al Jazeera: "I think the momentum would be very difficult to maintain now because of the nature of the protests that have become more violent.

"They are not only defying the results of the elections but they are now perceived to be defying the directions of the supreme leader, and so, in essence, questioning the foundation of the Islamic Republic," she said.

In a sermon on Friday, Khamenei ruled out any fraud in the June 12 vote and stressed there could be no doubting the re-election of Ahmadinejad.

An unnamed ally of Mousavi told the Reuters news agency that the former prime minister has said he would continue his fight and was "ready for martyrdom".