Plus, read more insight on Iran's election from other Daily Beast writers.

The Ayatollah Ali Khamenei, Iran’s supreme leader and the country’s most powerful man, has unwittingly transformed a protest into a revolution.

“If there is any bloodshed, leaders of the protests will be held directly responsible,” he warned Friday, in an attempt to put an end to accusations of voter fraud in the presidential election that returned Mahmoud Ahmadinejad to power. “The Islamic republic would not cheat and would not betray the vote of the people.”

What Khamenei seems not to recognize is that the uprising in Iran is no longer about a disputed election. It is about his own legitimacy as Iran’s supreme leader.

In throwing down the gauntlet to the protesters, Khamenei spoke with the confidence of a man who believes his is the final word on all matters legal and religious. In his speech he even implied that questioning his decision on the matter would be tantamount to questioning the authority of the Prophet Muhammad.

But what Khamenei seems not to recognize is that the uprising in Iran is no longer about a disputed election. It is about his own legitimacy as Iran’s supreme leader. It is about the very notion of clerical rule. It is, ultimately, about the future of the Islamic republic.

Iran’s confusing and convoluted political structure consists of two parallel governments. The first, meant to represent the sovereignty of the people, includes a (usually) popularly elected president, a parliament charged with creating and debating laws, and a fairly independent judiciary whose task it is to interpret those laws. The second, “shadow” government, meant to represent the sovereignty of God, consists of the supreme leader and a host of powerful subcommittees with wonderfully Orwellian names like the Assembly of Experts or the Council of Guardians, whose primary function is to act as a bridge between the elected government and the unelected supreme leader.

Called Valayat-e Faqih, or “Guardianship of the Jurist,” this unique religio-political system was the brainchild of the founder of the Islamic republic, the Ayatollah Ruhollah Khomeini, who died in 1988. In theory, the faqih—what the West calls the supreme leader—was supposed to be the most learned religious authority in the country. He was originally supposed to be a sort of pope-like figure that would ensure the Islamic nature of what would otherwise be a democratic state. He would have moral and spiritual authority, and he would certainly wield enormous political influence, but he would by no means maintain direct political control over the state.

However, in the years following the revolution of 1979, through a series of constitutional amendments pushed through parliament, the position of faqih was gradually transformed from a symbolic moral authority into the supreme authority of the state. Suddenly, the faqih had the power to appoint the head of the judiciary, to be commander in chief of the army, to dismiss the president, and to veto all laws created by the parliament. Originally intended to reconcile popular and divine sovereignty, these reforms essentially paved the way for the institutionalization of absolute clerical control.

The remarkable thing about Khomeini’s innovative religio-political system is that it stood in contradiction to more than 1,000 years of Shiite theology. Shiism is a messianic religion in that it eagerly awaits an “End Times” when the messiah (called the Mahdi in Islam) will return to sweep away the old order and replace it with the perfect state, the kingdom of God. Hence, only a government administered by the messiah after he returns to earth can be considered legitimate. A government run by human beings—whether monarchy, democracy, or theocracy—is considered a usurpation of the messiah’s authority, which is why the religious clergy in Shiism have for centuries maintained a deep and abiding commitment to political quietism.

Khomeini argued, however, that in the absence of the messiah, the people must rely on his agents on earth (i.e., the clergy) to carry out the messiah’s duties and responsibilities. That includes establishing the perfect state for him. Simply put, rather than wait for the messiah to return to create the kingdom of God, the clergy should build the kingdom of God for him, thereby ushering in the messiah’s return (a uniquely Islamic take on Christian millenarianism).

For the vast majority of Khomeini’s fellow ayatollahs, including practically all of his superiors, this was a scandalous idea. Khomeini was accused of appropriating the authority of the messiah for himself; in effect, declaring himself to be the long-awaited Mahdi. Of course, Khomeini never made any such statement, nor did he ever explicitly identify himself with the Mahdi. Rather, like any good messiah, he simply embraced the messianic imagery of the Mahdi and allowed his followers to draw their own conclusions. For example, he eagerly accepted the title “The Imam,” an appellation reserved solely for the Mahdi when he returns to earth.

During Iran’s horrific eight-year war with Saddam Hussein’s Iraq, Khomeini cast the battle as revenge for the Sunni massacre of the Prophet Muhammad’s grandson Husayn and his family at Karbala, even though such vengeance is the exclusive right of the Mahdi. “The blood of our martyrs [is] the continuation of the blood of the martyrs of Karbala,” he proclaimed.

But by far the most overt connection Khomeini established between himself and the messiah was his doctrine of the Valayat-e Faqih. In Khomeini’s view, the faqih would have more than just supreme authority, he would have infallible and divine authority—authority that, in fact, would be equal to the authority of the Prophet Muhammad.

“If a knowledgeable and just faqih undertakes the task of forming the government, then he will run the social affairs that the Prophet used to run and it is the duty of the people to listen to him and obey him,” Khomeini wrote in his magnum opus Islamic Government. “This ruler will have as much control over running the people’s administration, welfare and policy as the Prophet… had, despite the special virtues and the traits that distinguished the Prophet… [he will have] the same power as the Most Noble Messenger… in the administration of the society…[he] will hold the supreme power in the government and management and the control of social and political affairs of the people in the same way as the Prophet.”

This was a startling, some would say heretical, statement, but it was vital to Khomeini’s success in achieving absolute power. By linking his own authority with the infallible authority of the prophet of God, Khomeini was able to reinterpret traditional Shiism to give him absolutely and unquestioned authority over the state.

When Khomeini died, that authority was passed down not to the next senior-most ayatollah in Iran, as the doctrine of Valayat-e Faqih would require, but to a midlevel cleric who was not even an ayatollah at the time: Ali Khamenei. There was a simple reason for this. The senior-most ayatollah and the man who, according to the doctrine, should have been supreme leader was the Grand Ayatollah Hussein Ali Montazeri, who publicly rejected the theory of the Valayat-e Faqih and, as a result, has spent the last three decades under house arrest. (Montazeri is still the country’s highest religious authority and has thrown his full support behind the uprising.)

Khamenei was chosen to succeed Khomeini because he was considered a safe bet, someone who would not rock the boat, someone who could be easily controlled by more powerful, more charismatic figures who chaired the various clerical subcommittees, like his fellow revolutionary Hashemi Rafsanjani (now an ayatollah himself), who was instrumental in Khamenei’s selection to the post of supreme leader.

Devoid of Khomeini’s charisma and his religious credentials, Khamenei dropped into the background. Throughout his term as faqih, he has consistently played the role of neutral interlocutor among the competing poles of power in Iran, always strenuously portraying himself as the above the fray of common politics. This hands-off approach resulted in the gradual diffusion of the faqih’s powers both to the subcommittees beneath him and, more disastrously, to the state’s military-intelligence apparatus, the Revolutionary Guard, which has become arguably the most powerful force in Iranian politics ( see my piece on how the stolen elections represent a military coup by the Revolutionary Guard). At the same time, the ranks of junior clergy studying in Iran’s seminaries have begun increasingly to question the theological validity of the Valayat-e Faqih, especially now that Iraq’s more traditionally inclined (read: politically quiescent) clergy, headed by perhaps the senior-most ayatollah in the world, Ali al-Sistani, have become increasingly active in Iran.

Now it seems Khamenei wants his divine authority back. Yet by so enthusiastically—and, as even his confidants have admitted, inexplicably—inserting himself directly into the election controversy, he has destroyed his reputation as a “divinely guided arbiter.” Worse, by so forcefully backing the unpopular Ahmadinejad, he has tainted himself with an aura of corruption and scandal. In short, Khamenei has utterly, perhaps irreparably, damaged the office of supreme leader. That is why the very people who helped put him in power 20 years ago are now trying to get rid of him. (As I write this, Ayatollah Rafsanjani is currently in Qom trying to garner support from his fellow Assembly of Expert members to remove Khamenei from power.)

Simply put, Khamenei’s reckless and rambling Friday sermon has changed the tenor of Iran’s uprising, making it as much about his own leadership and the nature of clerical rule, as it is about Ahmadinejad’s presidency. He has, in other words, helped create a revolution.

Reza Aslan, a contributor to the Daily Beast, is assistant professor of creative writing at the University of California, Riverside and senior fellow at the Orfalea Center on Global and International Studies at UC Santa Barbara. He is the author of the bestseller No god but God and How to Win a Cosmic War.