TEHRAN, Iran -- Just weeks after Mahmoud Ahmadinejad's election victory in 2005, Iran's top nuclear negotiator Hasan Rowhani stepped down from the post after quarrelsome meetings with the new president.
The decision cemented Rowhani's reputation as a moderate who rejected Ahmadinejad's combative approach in world affairs in favor of the more nuanced philosophy of Ahmadinejad's leading political foe, former President Akbar Hashemi Rafsanjani.
Rafsanjani was barred by Iran's election guardians from Friday's presidential ballot. But for many reformists and liberals in Iran, Rowhani is somewhat of a mirror image of the elder Rafsanjani by reflecting his outlook that Iran can maintain its nuclear program and ease tensions with the West at the same time.
Rowhani, 64, was declared the president-elect Saturday after winning 50.7 percent of the more than 36 million votes cast. He takes office in August.
"Rafsanjani was really the only choice to re-energize reformists," said Rasool Nafisi, an Iranian affairs analyst at Strayer University in Virginia. "Rowhani only got their support because he is seen as Rafsanjani's man and a vote for Rowhani was a vote for Rafsanjani."
This deep connection between the two men could give Rowhani's presidency a dual nature: Rowhani as the public face and Rafsanjani behind the scenes as its powerful godfather and protector.
Although all key policies such as the nuclear program are directed by the ruling clerics, the alliance with Rafsanjani may give Rowhani more latitude to put his stamp on Iran's negotiation tactics with world powers after four rounds of talks since last year have failed to make any significant headway.
Rowhani -- the only cleric in the six-candidate presidential field -- started religious studies at a teenager. He soon established himself as an outspoken opponent of the Western-backed shah, traveling frequently for anti-monarchy speeches and sermons that caught the attention of Ayatollah Ruhollah Khomeini, the eventual leader of the 1979 Islamic Revolution.
Rowhani later graduated from Tehran University with a law degree in 1972. He then went abroad to Glasgow Caledonian University for a master's degree in legal affairs, according to his campaign biography.
While outside Iran, the stirrings of the Islamic Revolution were growing stronger. Rowhani returned to Iran and stepped up his denunciations of the shah, but fled the country to avoid arrest. He then joined up with Khomeini, who was in self-exile in France, and the rest of his inner circle, including Rafsanjani.
After the revolution, Rowhani rose quickly with various roles, including reorganizing the military, serving in the new parliament and overseeing the state broadcaster, which became a valued mouthpiece for Khomeini.
He strengthened his ties to Rafsanjani during the 1980-88 war with Iraq and, later, as Rafsanjani's top national security adviser during his 1989-97 terms. Rowhani continued the role with reformist President Mohammad Khatami, who also appointed Rowhani as the country's first nuclear envoy.
Rowhani took over the nuclear portfolio in 2003, a year after Iran's 20-year-old nuclear program was revealed. Iran later temporarily suspended uranium enrichment-related activities to avoid possible sanctions from the UN Security Council.