DUBAI U.S. President Barack Obama has twice written to Iranian Supreme Leader Ayatollah Ali Khamenei believing that he, not the president, holds ultimate power in the Islamic Republic and the key to unlocking the dispute over Tehran's nuclear program.
But the surprise emergence of President Hassan Rouhani, a close associate of Khamenei who advocates moderation, has shown a more nuanced picture of power in Iran in which the clerical leader listens to opposing views and then reaches a consensus.
Though supreme leader, Khamenei does not rule supreme.
"Of course Mr. Khamenei has his own personal viewpoints which in the last 10, 15 years until now have been stable and he insists on them and repeats them," said Aliasghar Ramezanpoor, a former deputy culture minister, listing Khamenei's deep distrust of the United States, Western cultural influence and his insistence on the nuclear program as a red line.
Himself president from 1981 to 1989, Khamenei "knows that on administrative issues of the country he must be flexible," Ramezanpoor told Reuters.
The Iranian political system is a complex mix of Shi'ite Muslim clerical authority and an elected president and parliament, overseen by numerous appointed regulatory councils.
Then there are the elite Revolutionary Guards who, as well as being engaged abroad - for example helping train government forces in Syria's civil war and supporting Hezbollah militants in Lebanon - also control large parts of the oil-based economy.
Though all roads lead to the leader, Khamenei also has to satisfy these constituencies and balance their interests, especially those of the Revolutionary Guards.
"Khamenei is not a dictator in the classic sense, but there is no question that on particular issues such as the nuclear file he probably will have the last word," said Gary Sick, an Iran expert and former U.S. National Security Council official.
"He will listen very carefully to what is being said before he gives the last word and the last word may be more of a coalition-building effort than dictating exactly what the policy will be," he said.
"When an issue is raised in an expert report, or various factions argue a point, and not just one faction, he pays a lot of attention," said Ramezanpoor.
Khamenei's public comments suggest he believes that even if Iran were to give up atomic energy work that the West deems a smoke screen for attaining a nuclear arsenal, the United States is bent on regime change and so any concessions are futile.
From the supreme leader's perspective, there are good grounds for thinking that way. Even though Obama offered soon after coming to office in 2009 to extend the hand of peace to Iran if it "unclenched its fist", his administration has imposed what it has called "the most robust sanctions in history" on Iran's vital oil industry, its shipping and banking sectors.
Together, U.S., European Union and United Nations sanctions have helped cut in half Iran's oil exports since 2011, raise inflation to more than 40 percent and devalue the rial currency by nearly two-thirds since the start of 2012.
Yet Rouhani has said he is open to direct talks with the United States [ID:nL6N0G737T], with which Iran has had no diplomatic relations since soon after its 1979 revolution.
In doing so, the president has at least proclaimed a change of tactics that appear to be at odds with Khamenei's long-held views. It is not, however, a change of policy since Rouhani also insists he will never relinquish the Islamic Republic's "right" to nuclear technology.
Indicating he will at least give Rouhani a chance to try out the new posture, Khamenei has most recently said he is also not against direct talks, but merely doubts they will succeed.
Khamenei allowed each of the two previous presidents, the reformist Mohammad Khatami and the populist hardliner Mahmoud Ahmadinejad, a period of grace in which they pursued policies he disliked before he blocked them and rendered them ineffective.
What power each president has is founded on the fact that he is elected by popular ballot, albeit one in which only approved candidates are allowed to stand. As such, he represents the republican half of the Islamic Republic equation.
The question of whether sovereignty comes from God or the people has often played out violently across the Middle East but appears to be contained within a perennial tug of war in Iran.
Khatami's attempts to relax social restrictions and institute the rule of law, and Ahmadinejad's populist nationalism in his second term, proved a challenge to Khamenei, hardline conservatives and the Revolutionary Guards.
NOD TO POPULAR WILL
Khamenei's backing of Ahmadinejad's disputed 2009 re-election in the face of huge demonstrations also eroded the popular legitimacy of the Islamic Republic and may well have dissuaded the leader from standing in the way of Rouhani's win.
Khamenei, said Ramezanpoor, "felt that all the people ... were worried about the situation in the country, and were getting upset with him and that things might get worse for him. On this basis he compromised".
A high-echelon insider who has worked with Khamenei since before the 1979 revolution, Rouhani has a better chance than his predecessors of negotiating Iran's Byzantine corridors of power.
For now Rouhani has the blessing, or at least the acquiescence, of Khamenei, but probably a limited window in which his attempt to engage with the outside world and ease sanctions has to show results, or be cast aside.
But even before beginning the task, Rouhani may already be facing turf battles at home. More than two months after his election, the president is still deciding whether to switch the job of chief nuclear negotiator from the Supreme National Security Council to the Foreign Ministry.
While the council would retain oversight, removing it from the talks process could streamline negotiations from Iran's side since the likes of the Revolutionary Guards, the judiciary and parliament all have places on the council.
The fact that the decision over who should be the point person in Iran's most important foreign policy issue has taken so long hints at a vigorous backroom debate and possible resistance from those who might feel sidelined by the move.
Rouhani himself was the chief nuclear negotiator during Khatami's presidency.
Securing the backing of Khamenei, perhaps better described as a final arbiter than leader, will prove the key to Rouhani's progress. "Rouhani is an insider and is certainly not naïve about what goes on in Iranian politics," said Sick.
"I think he is proceeding very cautiously. He is taking one step at a time, he is probably clearing it as he goes, staying in touch with the supreme leader and bringing him on board ... that is good politics and a smart way to run your show."
(This story is refiled to fix word in 16th para to read "doing")
(Writing by Jon Hemming; Editing by Mark Heinrich)