Conventional wisdom about Iran has long been that the nation's senior Muslim cleric would have the final say on domestic and foreign policies, no matter who won the June 12 presidential election.
But that calculus has been challenged with the explosion of protests in the streets. Iran analysts say Supreme Leader Ayatollah Ali Khamenei could well emerge diminished in stature because of his too-quick confirmation of victory of incumbent President Mahmoud Ahmadinejad -- an outcome now discredited by allegations of fraud.
"Whatever happens, Khamenei comes out looking bad," said Judith Yaphe, an Iran specialist at the National Defense University.
"It's a turning point," she added. "There has been nothing like this since the  revolution."
She and other analysts sketch three scenarios, none of which is friendly to Ayatollah Khamenei.
• The first and most likely scenario is that an investigation the ayatollah ordered Monday into the election results by the Guardian Council, a body largely appointed by the supreme leader, grants additional votes to Mir Hossein Mousavi and other challengers, but the incumbent still wins. Protests eventually peter out, but supporters of Mr. Mousavi, who have risked their lives to come into the streets, still feel cheated, and the situation remains unstable.
• A second scenario has the government cracking down on protesters as China did in Tiananmen Square in 1989. In that case, Ayatollah Khamenei remains in power - but "at a huge cost" to his legitimacy, Ms. Yaphe said.
• In a third scenario, the government concedes that the election results were doctored and Mr. Mousavi becomes president, in which case Iran will in effect have gone through another popular revolution.
"If Mousavi comes out as the victor, the supreme leader's role would be very much redefined," said Hadi Ghaemi, a spokesman for the International Campaign for Human Rights in Iran. "His powers will have been shown not to be absolute."
Since the 1979 revolution, Iran has had a unique form of government -- a so-called Islamic republic that combines clerical oversight with regular elections for president and parliament. Iranian leaders have long bragged that their nation is far more democratic than the monarchies and "hereditary" democracies in nearby Arab states, and they point to Iran's voter turnout, which typically exceeds 50 percent.
However, clerical authorities vet candidates for elected office, disqualify opposition figures and have overruled reforms enacted by parliament that would have diminished the power of the supreme leader. Election irregularities have been reported in the past but have not sparked such massive protests.
The brazen way in which the regime announced the election results when the polls had barely closed and gave figures that many Iranians found implausible have now put Ayatollah Khamenei on the defensive before his own people, analysts say.
Mehdi Khalaji, who observes the supreme leader at the Washington Institute for Near East Policy, said Ayatollah Khamenei miscalculated badly by initially accepting the election results as "divinely blessed."
In Mr. Khalaji's view, the supreme leader has sided with Mr. Ahmadinejad and hard-line members of the security forces because the ayatollah has never commanded the respect of revolutionary leaders from his own generation.
"This is a battle between Khamenei and a generation that does not owe its political credentials to him," Mr. Khalaji said.
Mr. Mousavi is a former prime minister and is backed by two ex-presidents -- Mohammed Khatami and Ali Akbar Hashemi Rafsanjani.
Peter Ackerman, the founding chairman of the International Center on Nonviolent Conflict, said he did not know whether the stirrings in Iran represented a full-fledged colored revolution like those that have occurred in recent years in Ukraine, Lebanon and Georgia.
"Historically, these movements need to involve widespread support from all the key cultural and demographic elements in the society, and they need to have leaders who can sustain the pressure for months -- not weeks, not days," he said. "Once the heat is out for the moment, where will the movement be?"
Mr. Ackerman's group in 2006 sponsored a workshop in the United Arab Emirates for Iranians on the strategic application of civil disobedience. Some of the participants were arrested later that year by Iran's security services that accused them of trying to foment a velvet revolution in Iran.
Mr. Ackerman said the purpose of the workshop was "to review the strategic principles underlying successful civil-resistance movements."
"Those principles are extremely relevant right now in Iran," he said.
Suzanne Maloney, an Iran specialist at the Brookings Institution's Saban Center, said the political chaos in Iran will make it far more difficult for the United States to engage with the country -- at least in the short term.
Who ultimately emerges as president does matter, she added, noting that Iran was less repressive internally and less belligerent abroad when Mr. Khatami was president from 1997 to 2005.
Since Mr. Ahmadinejad was elected in 2005 with the apparent blessing of Ayatollah Khamenei, "we've seen creeping authoritarianism from the military and demagogic populism from Ahmadinejad," she said.
The presidency "matters for the mind-set and opportunities of the Iranian people," she said.
Even if Mr. Ahmadinejad prevails, Ms. Maloney and other specialists said, Iran has been irrevocably changed by the unprecedentedly open debate that preceded the election, the more than 80 percent voter turnout and the massive demonstrations that have followed.
"These are historic events unfolding," she said. "We are very possibly at the brink of dramatic change in Iran. For the first time in 30 years, a very energized public is willing to risk its lives on the streets."
• Eli Lake contributed to this report.