By Jim Muir
former BBC Tehran correspondent
Mir Hossein Mousavi's supporters say the election has been rigged
On the face of it, the disturbances currently shaking Tehran in the wake of Mahmoud Ahmadinejad's controversial re-election look very similar to the street clashes that erupted there in July 1999 and June 2003.
As happened then, thousands of angry and disillusioned people, their hopes for change frustrated, have taken to the streets, clashing with security forces and hardline vigilantes who roam the city on motorcycles.
Buses and banks have been burnt, and student dormitories raided by police or irregulars, as happened on those earlier occasions.
The 1999 and 2003 disturbances involved thousands of protesters, rather than the millions it would take to shake the Islamic regime seriously.
They petered out after about 10 days, and achieved nothing, in the face of stern repression.
Will that be the fate of the current protests, too?
'Very different' protests
Perhaps. But there are some fundamental differences that might lead events in other directions.
While venting the same general frustration felt by many Iranians at the suppression of change and reform, the earlier protests were limited grassroots events that failed to connect to the political strata.
More than 100 opposition figures arrested, including the brother of ex-reformist President Khatami.
Local and international phone and text message services interrupted
Social networking and newspaper websites blocked
BBC says "heavy electronic jamming" from inside Iran disrupts its Persian TV service
International journalists arrested and asked to leave
Iranian newspapers do not carry reports of the violence
Source: Various reports
They were "bottom-up", generally incoherent, and lacked a political vehicle to sustain them.
In both instances, they were sparked by incidents at Tehran University which spilled over into violence in the streets, raising memories of revolutionary upheavals that few Iranians want to see repeated.
Because those protests were openly encouraged by the administration of the former US President George W Bush, reformist Iranian politicians had to shun them for fear of being dubbed traitors.
This time it is very different.
The protests are in reaction to specific political grievances involving senior politicians well-embedded in the Iranian system.
On Monday, they led to a peaceful mass demonstration in Tehran - despite an official ban - that by all accounts ran into hundreds of thousands, far bigger than any of the earlier protests, and too big for the authorities to disperse without causing potentially more serious repercussions.
The current protests bring together grassroots sentiment and the political level in a way that the earlier protests did not.
That carries the current dissension into the heart of the Islamic power system.
The man at the centre of the storm, presidential challenger and runner-up Mir Hossein Mousavi, is not some lightweight outsider.
Ahmadinejad supporters have also rallied in Tehran
He was Iran's prime minister from 1981 until 1989, and was generally given high ratings for running the country through almost all of the eight years of war with neighbouring Iraq.
One of his closest associates and backers, Ali-Akbar Hashemi Rafsanjani, is an even weightier figure who has been a major pillar of the Islamic Republic since its foundation.
Twice president, from 1989 to 1997, Mr Rafsanjani is a pragmatic conservative who currently heads two of the regime's most powerful bodies: the Expediency Council (which adjudicates disputes over legislation) and the Assembly of Experts (which appoints, and can theoretically replace, the Supreme Leader).
He also wields huge influence and economic clout behind the scenes.
But in this year's presidential campaign, Mr Rafsanjani was bracketed together with Mr Mousavi and lambasted vitriolically by
in televised debates.
Mr Mousavi was also supported by another two-term former president, the reformist Mohammad Khatami, who withdrew his own candidacy in Mr Mousavi's favour and is now also calling for the vote to be cancelled and re-run.
The same demand has been made by another of the election losers, Mohsen Rezaie, who for 16 years commanded the Revolutionary Guards, another of the regime's main pillars.
In addition to alienating reformist and centrist circles, Mr Ahmadinejad (the first Iranian president not to be a cleric since 1981) is also not uniformly backed by hardline conservatives, including the religious establishment in Qom.
Where he is believed to enjoy huge support is among the Revolutionary Guards Corps and its auxiliary basij (volunteer) militia; he has built up a strong following and patronage there.
His support among the military is such that many Iran analysts have portrayed what has happened as a kind of military coup from within the regime.
But Mr Ahmadinejad has also won much support among the poor by pursuing a populist political and economic policy, disbursing funds in rural areas in a manner that his critics say has added to Iran's woes by generating high inflation.
The rift he has created appears to transcend the old division between hardliners and reformists within the system, bringing together some elements on both sides against his abrasive militarist-popularist line.
Much will clearly now depend on whether the street demonstrations escalate, whether the authorities respond violently, and what decision emerges from the Council of Guardians
An American-originated opinion poll published in the Washington Post has suggested that Mr Ahmadinejad's surprisingly large margin of victory might in fact reflect the genuine will of the Iranian people.
The poll, conducted three weeks before the vote, indicated that Mr Ahmadinejad would win by a ratio of 2:1, slightly higher than the actual declared outcome.
But the near universal assumption of his rivals' supporters - and of most Iran analysts and much international political opinion - seems to be that he could only have won so massively by an unprecedented use of electoral fraud.
Whatever the case, perception is what counts. And the perception of large numbers of Iranians that their votes were "stolen" presents the authorities - and especially the Supreme Leader Ayatollah Ali Khamenei - with a burning dilemma.
Much will clearly now depend on whether the street demonstrations escalate, whether the authorities respond violently, and what decision emerges from the Council of Guardians, the highly-conservative oversight body which has 10 days to adjudicate appeals lodged by Mr Mousavi and Mr Rezai.
Ayatollah Khamenei has urged the Council to study the claims closely.
Its decision could provide him with a way out of a dangerous situation and avert an eventuality where Mr Ahmadinejad could emerge in such a powerful position that Ayatollah Khamenei's own standing could be undermined, with traditional balancing power centres eclipsed.
Much must be going on behind the scenes, involving key figures such as Mr Rafsanjani, from whom little has been heard since the results were announced.
If the confrontation remains unresolved, he and others may have to decide whether to throw their weight behind an effort that could tear apart and bring down the system in which they have a big stake, or trim their sails and accept a reduced status.
To avert an escalation, Ayatollah Khamenei may have to find a way either to persuade the losers and their backers and followers that the results were genuine and fair, or to pacify them by other means - perhaps by curbing Mr Ahmadinejad or diluting his policies in some way.
'Worst outcome' for Obama
In general, the Islamic regime in times of crisis has tended to find a way of holding together in order to stay afloat.
But if the current situation deteriorates into straightforward confrontation and repression on the ground, chaos could ensue, with unpredictable results.
The regime's control mechanisms have barely begun to be tested. They are fearsome. But whether they would remain cohesive in a situation of prolonged civil strife and political polarisation is an unanswerable question.
All of this has produced the worst possible outcome for US President Barack Obama and others hoping to find a way towards dialogue with Tehran over nuclear and other issues.
Washington had studiously avoided expressing preferences before the vote, and has remained equally equivocal over the disputed outcome.
But clearly, it would have preferred to see a reformist victory, though aware that the Iranian president may set the political tone and influence the climate, but does not decide policy on such key issues as relations with the US, or Iran's nuclear ambitions.
For Mr Obama to have opened dialogue with Tehran under a credibly-re-elected Mr Ahmadinejad would have been difficult enough in US domestic political terms.
But American experts on US-Iran relations believe his task will be considerably complicated in Congress and elsewhere should the election be seen as rigged and the results imposed by repression.
The outcome has also played into the hands of Benjamin Netanyahu's hardline government in Israel.
Under pressure to come up with what it regards as concessions on the Palestinian issue, Mr Netanyahu has tried to argue that priority should go to what he sees as the true threat to the region - Iran.
If the Iranian election crisis is not somehow defused, he will clearly find it easier to argue his case that "the biggest threat to Israel, the Middle East and the entire world is the crossing of a nuclear weapon with radical Islam" and that there should be "an international coalition against the nuclear arming of Iran", as he said in his policy speech on Sunday.