Thus, when Khomeini died three months later in June 1989, the relatively unknown Ali Khamenei was appointed the country's new Supreme Leader. But from the outset serious questions were raised about his fitness to hold the post, not least because, before Khomeini, on his deathbed, appointed Khamenei an ayatollah, he had only been a mid-ranking hojatoleslam, well below Montazeri's Grand Ayatollah status. Montazeri's supporters responded by distributing "night letters" questioning Khamenei's qualifications. The Revolutionary Guards, who answer directly to the Supreme Leader, responded by placing Montazeri under house arrest, and humiliating him by forcing him to wear his nightcap rather than his white turban.
Khamenei, though, was deeply scarred by this experience, which might help to explain the deeply paranoid behaviour that has become one of the defining features of his term of office. Indeed, for most of his 22 or so years as Supreme Leader, Khamenei's main preoccupation has been to overcome the nagging doubts that, as a minor cleric, he does not enjoy the legitimacy to occupy such an exalted position.
One way of answering his critics has been to adopt an increasingly combative approach towards the West, particularly with regard to the vexed issue of Iran's nuclear programme. Time and again Iranian negotiators have come close to signing a deal with the West that would provide the necessary safeguards over the more sensitive aspects of Iran's nuclear activities, such as its stockpiles of fissile material and uranium enrichment. But on each occasion — the most recent being the US-hosted talks in Geneva in October 2009 — the Iranian negotiators have returned to Tehran only to have the entire deal scuppered on Khamenei's orders.
His desire to prove his ideological credentials even led him to authorise personally the recent wave of terror carried out by Revolutionary Guard units, including last October's failed assassination of the Saudi ambassador to Washington, and the series of attacks against Israeli diplomats in India, Georgia and Thailand earlier this year.
But no matter how hard Khamenei tries to persuade his critics that he is a fit custodian of his office, ordinary Iranians — the majority of whom have no great desire to live in a permanent state of anti-Western agitation — continue to raise questions about his suitability.
The most graphic demonstration of anti-Khamenei sentiment Iran has seen in recent years took place during Montazeri's funeral at Qom in December 2009, when he was laid to rest in the shrine of Hazrate Masqumeh, one of the most revered female saints in Shia Islam, in honour of his campaigning on behalf of women's rights. As Montazeri's body was laid to rest, a crowd of protesters denounced Khamenei, chanting: "Our shame, our shame, our idiot leader." A few days later another group of protesters gathered in the shrine and chanted "Death to the Dictator". No matter how hard he tries, Khamenei just cannot overcome the widely-held view in Iran that he has been promoted well beyond his modest talents.