In this Saturday, May 11, 2013 photo, former President Akbar Hashemi Rafsanjani waves to media as he registers his candidacy for the upcoming presidential election, while his daughter Fatemeh smiles, at the election headquarters of the interior ministry in Tehran, Iran.

Just weeks before Iran’s crucial presidential vote, Iran’s supreme leader is facing a new and unexpected dilemma that could derail his plans to restore regime legitimacy and bury the ghosts of Iran’s violent 2009 election.

Dramatically stepping into the race, with just minutes to spare before a Saturday deadline, was former President Akbar Hashemi Rafsanjani. The 78-year-old has been a controversial pillar of Iran’s Islamic revolution for more than a generation, and portrays himself as a centrist and inclusive savior of a system that has shifted dangerously to the right.

That message is a mixed blessing for supreme leader Ayatollah Ali Khamenei, analysts say. Mr. Khamenei wants to ensure high voter turnout – an almost certain result of a Rafsanjani run – but also control the process and replace the divisive and combative outgoing President Mahmoud Ahmadinejad with someone more loyal and less flamboyant.

Mr. Rafsanjani and Khamenei have often been at odds with each other: Hard-liners blasted Rafsanjani's bid to run with charges of "sedition," for backing the Green Movement during the 2009 election violence. In years past he has indicated a willingness to thaw US-Iran relations and has railed against destructive strains of "extremism" in Iran.

Despite Rafsanjani’s revolutionary pedigree, and hard-liners branding him a "traitor," he appeals to reformists for his potential to moderate the ruling system with sheer political heft.

“Khamenei will be under tremendous pressure to see this Rafsanjani move as an attack on the Islamic Republic and ultimately his position, and the position of hard-liners,” says Farideh Farhi, an Iran analyst at the University of Hawaii. “This may also be an opportunity for [Khamenei to rebuild legitimacy]. Whether he would see that as an opportunity, or he’s just too much under pressure or too paranoid and sees it as a threat only, we do not know.”

Now that candidates have declared themselves, Khamenei has several options. One is to consider Rafsanjani’s presence in the election as “ultimately … good for him, not only bringing more legitimacy to the Islamic Republic, but giving him a chance to right what many consider he has done wrong [by supporting Mr. Ahmadinejad so forcefully in the 2009 vote], and in the process enhance his own role and legitimacy,” says Ms. Farhi.

“But he also might see it as a personal challenge, as a first step to completely dispossess him of all power,” adds Farhi. “Or, there is also the possibility that he might really think that Rafsanjani’s direction of the country, or what he’s suggesting, is wrong. One could see this as a real intellectual disagreement, with political implications.”

686 presidential candidates

The former two-time president is not the only wild card in the presidential race. Also registering in the final minutes on Saturday was Ahmadinejad’s chief of staff, relative by marriage, and chosen successor, Esfandiar Rahim Mashaei.

Ahmadinejad’s presidency has at times challenged the supreme rule of Khamenei. For example, in 2009 Khamenei took the rare step of publicly opposing Ahmadinejad’s choice of Mr. Mashaei as a vice president. And critics across the conservative political spectrum have accused Mashaei of leading a “deviant current” and even of practicing “sorcery” within the presidential administration.

Both Rafsanjani and Mashaei, among all 686 Iranians who registered as presidential candidates, must be vetted by the Guardian Council. This vetting process is expected to cut the field down to a dozen or less.

Hard-liners called for Rafsanjani to be prevented from running because of his supposed "sedition." Mehr News reported that nearly 7,500 lawyers called upon the Guardian Council to reject candidates "regardless of their name or fame" who were "part of the sedition of 2009."

Mashaei could be disqualified as well, due to Khamenei's evident dislike of him, though Ahmadinejad has threatened to reveal compromising secrets about key regime people if Mashaei’s candidacy is blocked. Already Ahmadinejad’s presence beside Mashaei when he registered on Saturday has been deemed a violation of Guardian Council rules. Parliamentarian Ahmad Tavakoli accused the president of acting like “despotic rulers” in choosing his successor.

The hard-line editor of Kayhan newspaper, who is an official representative of Khamenei, said both Rafsanjani and Mashaei were "locked in their cocoon of illusions and will receive a slap in the face."

'High turnout'

The candidacies of both Rafsanjani and Mashaei may force Khamenei to recalculate his election plan.Conventional wisdom for months was that a so-called 2+1 committee of conservative loyalists – including the popular mayor of Tehran Mohammad Baqer Qalibaf, and former foreign minister and Khamanei adviser Ali Akbar Velayati – would choose which among the three of them was most likely to win. This choice would then be seen as Khamenei’s “choice.”

But a unity candidate has proven elusive, and all three members of the 2+1 committee have registered to run, along with many other key personalities, including current nuclear negotiator Saeed Jalili, former nuclear negotiator Hassan Rouhani, former Revolutionary Guard commander Mohsen Rezaei, and other former officials. News reports indicate that the 2+1 group might now support Mr. Jalili.

The high-profile characters may help provide high voter turnout, one silver lining for Khamenei, despite uncertainty about the result. During some 30 elections since the founding of the Islamic Republic in 1979, the regime has equated high turnout with legitimacy.

“The main preoccupation of Khamenei, aside from securing a less confrontational president, is ensuring high turnout,” says Mohammad Ali Shabani, a doctoral researcher at the School of Oriental and African Studies in London. Rafsanjani’s participation “will boost turnout and most likely be counterbalanced by a strong pro-Ahmadinejad candidate,” says Mr. Shabani. In this scenario, Rafsanjani and Mashaei would “split anti-establishment votes,” enabling a conservative unity candidate to rise above them.

Rafsanjani “is highly conscious of his limitations and the need to pass on power to the next generation,” says Shabani. Yet his candidacy “will put Rafsanjani in a position where his interests are best served as kingmaker, rather than king…. The ‘people’s savior’ is most likely to save his people by uniting the main political forces rather than worsen divisions in this tense time.”

'A very clear message'

A tweet sent to the Monitor from Mr. Rouhani’s campaign, which is close to Rafsanjani, indicates that political deals are still in the works.“Rouhani remains in the race, joining forces with [Rafsanjani]. On election day, 1 of them will withdraw,” the tweet read.

Rafsanjani was instrumental to the elevation of Khamanei to the supreme leader position in 1989 after the death of Ayatollah Ruhollah Khomeini, the founder of Iran’s Islamic revolution. Today Rafsanjani is wealthy and often seen as a quintessential establishment man.

Rafsanjani served as president for two terms until 1997. However, he was trounced by Ahmadinejad in a second round runoff vote in the 2005 presidential election. His clerical turban and reputation as a decades-long insider counted as a strike against him, as Ahmadinejad appealed to the pious poor as a populist outsider.

In the 2005 campaign, Rafsanjani aides warned against “Islamic fascism” taking over Iran. The day he cast his ballot back then, Rafsanjani said he was “destined to serve the revolution until the last day of my life. I intend to play a historical political role, to stop the domination of extremism.”

This he attempted to do, even before the 2009 election, when he warned Khamenei that Ahmadinejad’s criticism of icons of the revolution would yield “volcanoes that are fueled by people’s anger” in society.

More than one month after the 2009 vote, when weeks of protests against election fraud claimed scores of lives and raised questions of regime legitimacy for millions of Iranians, Rafsanjani addressed Friday prayers in Tehran. He sympathized with the protesters' grievances, stating: "We should open the doors to debates. We should not keep so many people in prison ... [security forces] have to guarantee such a climate for criticism."

Rafsanjani said: "People have lost their faith in the regime and their trust is damaged." It was the last time he was allowed to address Friday prayers. Several family members were arrested at the time for protest involvement, and since then Rafsanjani's children have had brushes with security forces.

Khamenei stepped in. He called Ahmadinejad’s tainted 2009 victory a “divine assessment,” and said his own views more closely matched those of Ahmadinejad, not Rafsanjani. Since then, Iran’s economy has been rocked by US and Western sanctions over Tehran’s nuclear program; the president has directly challenged Khamenei’s rulings; and Ahmadinejad’s handling of many issues has been viciously condemned.

“It shows that Iranian politics remain extremely improvised and difficult to predict – not only for us, but for the players themselves,” says analyst Farhi. “We now know that Mr. Rafsanjani made the decision to run while his advisers were writing his note trying to explain … why he wasn’t running.”

Rafsanjani “has a very clear message. This is not about Ahmadinejad. This is about the securitization of the country, and the direction the country has taken – whether it’s under Khamenei’s leadership, or because forces in the security establishment have become more powerful and shaped [Iran’s] direction,” says Farhi. His reason for running is to bring the country to the middle, and “move away from extremes that …have led to very, very difficult circumstances for Iran.”