There seems little doubt now that something resembling a coup d'état has been attempted in Tehran. The next few days will reveal if it is to succeed. In scenes not witnessed since the mass protests that brought about a revolution that deposed the Shah in 1979, violent demonstrations have broken out in multiple Iranian cities. Crowds chant anti-Ahmedinejad slogans such as "Death to the Dictator". Hundreds of thousands of supporters of the candidate heavily defeated in Friday's presidential election, Mir Hossein Mousavi, have rejected his defeat – claiming foul play. They are joined by key figures from Iran's political elite including the Association of Combatant Clerics who are calling for the result to be annulled. All three defeated candidates, including the conservative Mohsen Rezaee, a former head of the Revolutionary Guards, reject the election results as fraudulent.

Overnight in what looks like a purge of the opposition up to 100 opposition figures were arrested including reformist politicians such as the brother of ex-President Mohammad Khatami and Mohsen Mirdamadi, a leader of the 1979 hostage crisis; further arrests included journalists such as Ahmad Zeidabadi; other reports suggest Mousavi and fellow reformist candidate Mehdi Karroubi are under house arrest. Although communications across Iran have been severely restricted, it seems that protests continued late into the night with crowds clashing with security forces, the basij militia and vigilante groups.

This crisis in Iran has two broad possible outcomes: either the regime will back down and arrange for a recount or the security forces will act to preserve control by using ever more violent means to quash the demonstrations. Unfortunately, the latter scenario seems more probable.

At this point, it is pertinent to ask who is running the show: is Ali Khamenei, the Supreme Leader and official head of state, really holding the levers of power, or has control been seized by re-elected President Ahmedinejad? What about ex-President Hashemi Rafsanjani, head of the Expediency Council, who was humiliated by the Supreme Leader yesterday and portrayed as corrupt and traitorous. Some suggest that he has travelled to Qom, Iran's holiest city, to try to persuade senior clerics to back him and Mousavi. Ever since the revolution, power in Iran has been fragmented and divided; now it seems more so than ever. At this stage and with such insufficient evidence it is extremely hard to tell what forces are really at play.

Perhaps the most reasonable reading of yesterday's story (in the light of currently available information) appears to be that forces loyal to Ahmedinejad succeeded in pressurising the release of falsified results. As the real numbers began to come in, Mousavi's office was apparently informed by the interior ministry that he had secured a large margin of victory, and so he declared success. Soon, however, in the face of severe pressure from his rivals, the electoral commission released falsified numbers suggesting a landslide victory for Ahmedinejad. In the meantime, in what looked very much like a pre-planned operation, security services had already blockaded the interior ministry and the offices of the reformist candidates, and set up positions at nodal points across the capital.

Khamenei quickly accepted the selection in an apparent violation of procedural norms: the electoral commission is required to delay final announcements for three days to allow for grievances to be registered. Ahmedinejad has insisted his election was sound and fair.

Communications networks across Iran have been under repeated attack: SMS services, used by those organising protests, were shut down; later mobile networks went out of service. Facebook and other networking sites have been blocked; internet connections are slow if they work at all. Nonetheless some computer-savvy Iranians use filter-busting programmes to bypass controls and have been able to send out reports. Clearly an attempt is being made to prevent the outside world from following events within Iran, and to stop domestic coordination of protests.

Iranian television did not cover the protests but instead carried cycled reports of the massive turnout of voters on Friday and Khamenei's confirmation of Ahmedinejad. Foreign journalists report that they have been accused of propaganda and told to leave the country; other correspondents have repeatedly been prevented from filming.

Even if the popular protests are brought under control, Iran's political landscape has been redrawn: this election has engaged and polarised not just Iranian society but also the political class, both clerical and laity. These protests differ fundamentally from previous post-revolutionary protests including the student riots of a decade ago. The demonstrations yesterday are much more significant as they are combined with an acute crisis in the machinery of the state. This crisis will largely play out behind the scenes with complex machinations determining the ultimate victors. At this initial stage Ahmedinejad seems to have a clear upper hand.

Iran's political earthquake clearly has domestic roots. As I have argued previously, the televised series of political debates between candidates was seminal. In particular, the Ahmedinejad/Mousavi debate broke established boundaries limiting discussion and placed before record public audiences allegations of corruption, misrule, nepotism, and even dictatorship. Was Ahmedinejad laying essential groundwork for his takeover during this debate? He pointedly linked Mousavi to both ex-President Rafsanjani and Khatami – declaring he was running against all three. Rafsanjani's open letter of protest to the Supreme Leader following Ahmedinejad's invectives yielded an ominous silence making possible Ahmedinejad's coup attempt. Was the Supreme Leader too unsure, too slow to act, or was he already backing Ahmedinejad?

Future events will elucidate the full story later. What does seem certain is that a turning point has now been passed. This turning point followed what analyst Karim Sadjadpour calls not a presidential election, but rather a selection. The status quo ante cannot now be restored: if the coup fails Iran's trajectory could speed towards reform on a wave of popular enthusiasm; if it succeeds the broad political space and the relatively wide spectrum of tolerated political opinion of preceding years may be under threat. Either way the aspirations of a large slice of Iranian society – either conservative or reformist - will be frustrated.

Out on the streets, Iranians have bravely defended their rights to participate in their politics, demanding back their "stolen" votes. While I have deep concerns for their safety and fear the violence of the revolutionary state, I applaud their courage and determination to stand up for their democratic rights and to command their own destiny.