Since the Islamic revolution in 1979, which toppled with breathtaking speed Iran's corrupt and secular shah, the country has had two rulers.

One is the package – standard in modern republics – of head of state and parliament. And then there’s the supreme leader, who, in practice, has to work with the consent of the nation’s formally democratic institutions but who, in theory, has the power to overrule them if he feels their actions run counter to God’s will. [Editor's note: The original version misstated the political hierarchy in Iran.]

The supreme leader today is Ayatollah Sayed Ali Khamenei, for 20 years now the successor of Ayatollah Ruhollah Khomenei, the charismatic preacher who defined the contours of the theocratic Iranian state and who died in 1989.

Karim Sadjadpour, a senior Iran analyst at the Carnegie Endowment for International Peace, called Mr. Khamenei "the single most powerful individual in a highly factionalized, autocratic regime" in a paper on the cleric last year.

High cost of controversial decision

It is Khamenei who has the ultimate responsibility for the apparent decision to skew Iran's presidential election in favor of his preferred candidate Mahmoud Ahmadinejad, and for unleashing the security forces that have killed at least 17 Iranians protesting the outcome in the past week, sending Iran into its greatest political crisis in 30 years.

Khamenei is preserving his vision, say analysts, of what the Islamic Republic should look like in the short term by denying the popular will. But he has taken that step, they say, at a cost so great to his own image and to that of the office he occupies that the Islamic Republic is unlikely to be the same again.

"It's easy to stop a riot or demonstration with violence, but it's not easy to regain moral authority once it's been chipped away by your actions," says Juan Cole, a historian of the Middle East and an expert on Shiite Islam at the University of Michigan. "This is the kind of thing the shah used to do. The revolution has always said it stands for justice and the rule of law, but a large segment of the public is not going to think that anymore."

Scholars of Iran say that while Khamenei has for most of his 20 years in power sought to avoid confrontation and played a behind-the-scenes role, he has always been devoted to adhering to Khomenei's call for a velayat-e-faqih, or "rule of the jurisprudent," which in practice means one man like Khamenei acting as "jurisprudent," or interpreter of God's rule on earth.

Adding word 'absolute' to his powers

Indeed, after Khamenei rose to Iran's most important position in 1989, he went further than Khomenei had, leading a successful effort to have the role of the faqih, or jurisprudent, defined more specifically in the Constitution with the insertion of the word "absolute" as in the "absolute rule of the jurisprudent."

When his younger brother Hadi Khamenei, a reformist cleric who favors more oversight and checks on the power of the supreme leader, called for this in a sermon in 1999, he was savagely beaten by basiji militia loyal to the ayatollah – the same group that has been used to attack protesters in recent days.

"I think, in some respects, what Khamenei has done in the past 10 years has been to amass even more authority institutionally than his predecessor ever had," says Suzanne Maloney, an Iran scholar at the Saban Center for Middle East Policy at the Brookings Institution in Washington. "He clearly sees the revolution itself as under threat, and Iran has already begun to deliver with the violence over the weekend. I think they're in a good position to repress, and I don't think Khamenei will blink."

Iran's 'Dick Cheney'

Ms. Maloney says that what he lacks in charisma and theological heft (he is not considered among the country's top scholars of Shiite Islam), Khamenei has made up for in building networks of appointees and other relationships in Iran's political elite.

"I've always thought of him as the Dick Cheney of Iran," she says. "You wouldn't have expected, based on his personality, that he'd amass this kind of power."

Scholars say that Khamenei's political activism under the shah, as well as his experience of being tortured by the shah's secret police, helped cement his view that the United States and Britain see Islam and Iran as implacable foes, with both countries supporting the shah and providing training and resources to his apparatus of repression.

"Clearly, he views the world as aligned against Iran, he talks about the Iran-Iraq war as a war of the world against Iran, not a war of two states," says Maloney. "He talks about Ahmedinejad's term in office in very glowing terminology, as someone who brought the revolution back to its roots and returned Iran from the brink of vulnerability."

In his analysis, Mr. Sadjadpour notes that the ayatollah's writings reflect "a resolute leader with a remarkably consistent and coherent – though highly cynical and conspiratorial – world view."

Mr. Cole, at the University of Michigan, says Khamenei's worldview has led him to see Iran's reformists as abiding threats, even though many of them just want to tweak the nature of the Islamic revolution, not overthrow it entirely.

"What a lot of the reformers want is consumer capitalism and international integration … and Khamenei sees this as an existential to the republic," says Cole. "Khamenei is afraid that if Iran isn't economically independent, then the US will find a way to get a hold of it again and subjugate it. A lot of his paranoia is that the reformists want to give away the show."