In May, when intelligence officials briefed Iran's supreme leader Ayatollah Ali Khamenei ahead of a snap presidential election, the report was bleak: most Iranians, frustrated by economic woes and curtailed social freedoms, intended to boycott the vote, expecting a turnout of only about 13 percent.

This prompted Khamenei to meticulously plan an election, paving the way for the lesser-known but trusted moderate, Massoud Pezeshkian, to ascend to the presidency, initially overshadowed by hardliners, according to five sources who spoke to Reuters. Khamenei convened several meetings with his closest advisors at his fortified residence in Tehran in late May to strategize, involving two hardline sources, a top security official, and two insiders from Khamenei's inner circle.

Concerned that low turnout would undermine the clerical establishment's credibility, Khamenei directed his advisors to manipulate the election's outcome, revealed one source privy to the discussions. The election was hastily arranged following President Ebrahim Raisi's death in a helicopter crash, which disrupted the plans of many hardliners who had hoped for his succession to the 85-year-old Khamenei.

The meetings at Khamenei's residence included a select group of senior officials, security aides, his close ally and advisor Ali Akbar Velayati, and two high-ranking commanders of the Revolutionary Guards. Khamenei aimed to stabilize the Islamic Republic amidst domestic unrest and escalating tensions with the West and Israel, particularly over Gaza, intensified by Tehran's allies in Lebanon and Yemen, as detailed by the five sources.

One insider disclosed that Khamenei sought a president who could resonate with various segments of society without challenging the Shia theocracy. Several names were considered, but Khamenei ultimately proposed Pezeshkian, who could unite the ruling factions, bridge the gap between the clerical establishment and the public, and facilitate a smooth transition for the next supreme leader, according to two sources.

Tehran-based pro-reform analyst Saeed Laylaz praised Khamenei's plan as flawless, ensuring the survival of the Islamic Republic. Pezeshkian, Laylaz noted, would prevent domestic crises, allowing top leaders to calmly plan the succession.

The new president is not anticipated to significantly alter Iran's nuclear or foreign policy, nor its support for regional militias, but he will play a crucial role in selecting Khamenei's successor. Pezeshkian's mild demeanor is expected to placate discontented Iranians, maintain domestic stability under foreign pressure, and provide Khamenei with a reliable ally in the succession process.

Pezeshkian's election was orchestrated to ease tensions following widespread protests sparked by the death of a young woman in custody and stricter social freedoms imposed by Raisi. Initially, Pezeshkian, encouraged by pragmatic former officials linked to Khamenei's office, registered for the June 28 election, unaware of the behind-the-scenes maneuvering.

Khamenei's plan was crafted to appear democratic, allowing two prominent hardliners, Saeed Jalili and Mohammad Baqer Qalibaf, to pass the vetting council, ensuring their votes would be divided, making a run-off less likely. Jalili, a member of the ultra-hardline 'Paydari' camp, advocates for tougher social restrictions and a hawkish foreign policy, believed to have already chosen a candidate for Khamenei's succession.

Pezeshkian, an Azeri ethnic minority, won the first round with support from urban middle-class and young voters, but the turnout was the lowest in the Islamic Republic's history, leading to a run-off against the anti-Western Jalili. Many Iranians who initially voted for Qalibaf or abstained supported Pezeshkian in the second round, boosting turnout to nearly 50 percent of Iran's 61 million voters.

Ultimately, Khamenei's strategy succeeded. Pezeshkian, a 69-year-old heart surgeon backed by reformists, moderate conservatives, and ethnic minorities, secured 54 percent of the votes. He expressed gratitude to Khamenei, acknowledging his crucial role in the election's outcome.

Pezeshhkian, committed to Iran's theocratic rule, promises a pragmatic foreign policy, easing tensions over stalled nuclear deal talks, and fostering social liberalization. He has advocated for women's and ethnic minorities' rights and criticized the establishment's handling of Mahsa Amini's death. However, analysts remain skeptical about his ability to fulfill all his promises, given his public stance of not challenging Iran's powerful clerics and security hawks.