At first sight, what is happening in Tehran today looks very like the extraordinary events of the Islamic Revolution 30 years ago. But how deep do the similarities go? On 2 December 1978, two million Iranians filled the streets of central Tehran to demand an end to the rule of the Shah and the return of Ayatollah Khomeini. It was the most popular revolution in history. At night, people gathered on rooftops to chant "Allahu Akbar – God is Great". In the daytime, mass rallies commemorated as martyrs the protesters who had been killed by the security forces.
The methods of protest are very similar. This is hardly surprising because the demonstrators seeking to get rid of President Mahmoud Ahmadinejad understandably hope the type of unarmed mass protest that worked against the Shah will succeed again. Mass rally and public martyrdom are part of the Iranian revolutionary tradition, just as the barricade is part of the tradition in France. A difference between 1978-9 and today is that the Iranian government has no intention of letting history repeat itself.
Nor is it likely to do so. The Iranian revolution was carried out by a broad coalition from right to left which had religious conservatives at one end and Marxist revolutionaries at the other. The Shah and his regime had a unique ability to alienate simultaneously different parts of the Iranian population which had nothing in common. His cruel but poorly informed Savak security men convinced themselves that communists and revolutionary leftists were the danger to the throne and not the Shia clergy. They were not alone in their delusion. President Jimmy Carter recalls an August 1978 CIA memo, drafted five months before the Shah took flight, firmly concluding that Iran "is not in a revolutionary or even a pre-revolutionary situation".
Crucially, the Iranian revolution had a messianic leader in Ayatollah Khomeini who was a visible alternative to the Shah, a leader whose claims to legitimacy were compromised even before he came to the throne: his father Reza Shah, an army general who seized power in the 1920s, was deposed by British and Soviet troops in 1941. His son was forced to flee in 1953 when Mohammed Mossadeq was elected prime minister, only to be restored by a CIA-run coup for which President Barack Obama has apologised.
More astute rulers might have tried to burnish their nationalist credentials but instead the Shah indulged in historical fantasies such as abolishing the Islamic calendar and celebrating the 2,500th anniversary of the founding of the Persian Empire at Persepolis in 1971. Foreign dignitaries and celebrities sipped drinks behind security cordons while Iranians were excluded.
What makes the Iranian revolution different from previous revolutions in the 19th and 20th centuries is that it was a religious revolution in terms of its leadership and inspiration. Thirty years later, when "Islamic revolution" is seen as such a menace in the West, it is difficult to recall what a surprising development it was in the late 1970s. Revolutions were supposed to follow roughly in the footsteps of the French, Russian or Chinese revolutions. Their tone was secular and anti-religious. Priests were the defenders of the established order.
There had been Islamic anti-colonial movements against the European empires and later against the nationalist regimes which succeeded them. But the record of these Islamic parties was one of failure. It was the Iranian revolution that made political Islam such a potent and, to its enemies, such a menacing force.
The revolution was not only Islamic, but was rooted in the theology and beliefs of one particular Islamic sect. At a moment when intelligence services were looking at Moscow, Peking and Havana as the inspiration for revolution, none of them foresaw the danger to the status quo that was brewing in the clerical seminaries of Najaf in Iraq and Qom in Iran. The birth of revolutionary Shi'ism surprised the world. In theory, Shia theology is more likely to spawn revolution than the Sunni because so many of its beliefs and ceremonies revolve around the lost battle of Kerbala in AD680. It was here that Imam Hussain, the grandson of the Prophet, and 72 of his companions and relatives, were massacred by the soldiers of the second Umayyad caliph Yazid 1.
It is a story of refusal to bow to injustice, of resistance to oppression and martyrdom. But this alone did not make Shi'ism a revolutionary ideology. Iran became Shia by the fiat of the Safavid dynasty in the 16th century. It was only in the 1950s and 1960s, in response to triumphant secularism, leftist revolutionary ideology and persecution by the Shah, that the Shia clergy of Iran and Iraq began to develop their own Islamic "liberation theology" which enabled them to take power in 1979.
The Iranian revolution was more deeply rooted than it appeared to be. It sprang from a coherent ideology. It succeeded partly because it caught its enemies, as well as most of its supporters, by surprise. But it was not a spontaneous event. Khomeini and the clergy who supported him were committed revolutionaries. They had thought out how to take power and how to keep it. They might decry nationalism, but it was their commitment to defending the Iranian nation from foreign encroachments which was so crucial to their success.
In 1964, Khomeini was expelled from Iran, to take refuge in Najaf, because of his opposition to extra-territorial rights for US government employees. The present Iranian leadership does not have the great weakness of the Shah, which was to be seen as the puppet of foreign powers.
By the time the Shah left Iran on 16 January 1979 he had almost no support. This again is very different from the present situation. President Ahmadinejad was re-elected with 62.6 per cent of the vote last week. His opponents claim the poll was rigged, although this is almost exactly the same as his vote in 2005, when he won 61.7 per cent. The point is that Mr Ahmadinejad is a popular politician and the Shah was not. He is very unlikely to be forced from power. Nor is he likely to surrender as the Shah did when he found he was unable to cope with the uprising.
The weakness of the Shah was not evident when the first demonstrations against him began in October 1977, after the death of Khomeini's son. The first demonstrators, religious students, were killed in early 1978 after an article in a government newspaper attacked Khomeini. Their deaths were commemorated 40 days later, according to Shia religious custom, and protests spread across Iran.
These demonstrations in some ways resembled civil rights marches in the US but they had greater impact because they were wedded to religious ritual and the commemoration of martyrdom. Politically, this was a potent blend. It appealed to the most conservative cleric and the most radical student alike. Even so, the marches and demonstrations might have run out of steam over the summer of 1978 if they had not been sustained by a network of clerical supporters of Khomeini in the mosques. Iranians from the slums and villages who had not benefited from the oil boom began to join in.
No crime was so bad that Iranians did not think that the Shah and his security men capable of it. When the Rex Cinema in Abadan caught fire and 400 people burned to death, it was widely believed Savak had started it.
The Shah, who appeared demoralized from an early stage in the crisis, used enough repression to make his regime detested but not enough to create lasting fear. His concessions conveyed confusion and weakness. Martial law was declared. On 8 September, so-called Black Friday, soldiers opened fire on demonstrators and were accused of killing thousands (though the real figure may have been much lower). These were the days when the Shah lost his last chance of staying in power.
He made one further unforced error which had disastrous consequences for himself. Khomeini had been in exile in Najaf, from which he could communicate with Iran but with some difficulty. Cassettes of his sermons had to be smuggled across the border. There was no international press corps in Iraq. But with self-destructive zeal, the Shah's emissaries persuaded the Iraqi government, in which Saddam Hussein was already the strongest figure, to expel Khomeini, who, after being refused entry to Kuwait, took up residence in a suburb of Paris in October.
In Paris, he had better access to the international press than the Shah and was able to communicate easily with Iran.
By the end of 1978, Iranians, even those opposed to the revolution, could see that the Shah was finished. His core military support began to waver. The clergy made every effort to infiltrate and propagandize his armed forces. In any case, he did not want to fight. By mid-January, he and his wife had left Iran forever.
On 1 February 1979, Khomeini returned to Iran to be greeted by several million Iranians and swiftly completed the takeover of power. He marginalised his secular allies from the year before and began to radicalise the revolution, culminating in November 1979 when clerical students took over the US embassy.
Recalling how the Shah had come back from exile with US support in 1953, any potential Shah supporters were imprisoned or shot.
The leaders of the new regime were intent on staying in power. They have not changed much today. The spectacle, the symbols, and the language in Iran in 2009 are similar to those present in 1978-9, but the political forces at work could not be more different. The protesters then were much stronger than they looked; those of today have the odds heavily stacked against them.