DUBAI (Reuters) - Iranian president-elect Hassan Rohani, who won a landslide victory promising better relations abroad and more freedom at home, on Sunday paid his first visit since the vote to Supreme Leader Ayatollah Ali Khamenei, who will ultimately decide the pace of any change.
Rohani, a mid-ranking Shi'ite cleric, is an Islamic Republic insider who has held senior political and military posts since the 1979 Islamic revolution and maintained a good rapport with Khamenei, Iran's most powerful man.
Iranian media reported that Khamenei congratulated Rohani, wished him success, and gave him "the necessary guidance".
Rohani's trouncing of his hardline rivals, who miscalculated the public mood and failed to overcome factional differences and field a single candidate, received a cautious welcome in Washington, although Israel warned against "wishful thinking" about Iran's future direction.
While no reformer himself, Rohani gained the backing of the politically sidelined but still popular leaders of the reform movement. His call for an end to an "era of extremism" won over many voters tired of the economic crises and crackdowns on free speech that marked Mahmoud Ahmadinejad's presidency.
However, Rohani's surprise win - taking just over 50 percent of the vote - is not expected quickly to resolve Tehran's nuclear stand-off with the West or break its commitment to backing President Bashar al-Assad in Syria's civil war.
U.S. President Barack Obama's chief of staff Denis McDonough said: "If he (Rohani) is interested in, as he has said in his campaign, mending Iran's relations with the rest of the world, there is an opportunity to do that."
Israeli Prime Minister Benjamin Netanyahu, who has urged ever tighter sanctions and has threatened military force to stop Iran getting nuclear weapons, said: "The international community must not give in to wishful thinking or temptation and loosen the pressure on Iran for it to stop its nuclear programme."
Rohani's win goes some way to repairing the legitimacy of the Islamic Republic, punctured four years ago when dozens were killed in protests after an election that reformists said was rigged, and may help pragmatic voices silenced since then to re-emerge.
Known in the West as Iran's main nuclear negotiator in 2003-05, Rohani immediately sought to build bridges, expressing approval of the street parties that welcomed his election but also having talks with the conservative speaker of parliament.
"With their celebrations last night, the Iranian people showed they are hopeful about the future and, God willing, morals and moderation will govern the country," he told Iranian television.
Whether Rohani succeeds in ushering in change, or the next four years yield the same stalemate that marked the 1997-2005 presidency of reformist Mohammad Khatami, will hinge on his ability to balance the demands and expectations of the people with the interests of those who hold the main levers of power.
Rohani may have an advantage that Khatami, director of the national library before becoming president, never enjoyed.
"Rohani is the ultimate regime insider. In contrast to Khatami, who held no governmental position when he was catapulted into the presidency, Rohani has never been out of power or Khamenei's good graces," said Ali Vaez, Iran analyst at the International Crisis Group.
"Also, Rohani is a centrist politician, with a unique bridge-building ability. He is unlikely to alienate competing power centres, who can stymie his reforms."
One big pointer will be whether Rohani pushes for the release of Mirhossein Mousavi and Mehdi Karoubi, the leading reformists held under house arrest since 2011. That demand was a constant chant of Rohani supporters at his campaign rallies and on the streets of Tehran and elsewhere overnight.
"This will in my view be the first real test of how sincere this election has been. Then we will know the calibre of Mr Rohani," said Ali Ansari, professor at St. Andrew's University in Scotland.
"Much depends on the political will of the fractured elite and the willingness of Khamenei to pull back. There is some anxiety that the powers that be, having got their 'popular election', will now settle back into their comfort zones."
Despite similarities between Khatami's and Rohani's upset election victories, the political realities "are fundamentally different", said Yasmin Alem, a U.S.-based Iran expert.
"The supreme leader is more powerful, the Revolutionary Guards are more influential, and the conservatives are more in control. However, Rohani is a crafty statesman and stands a better chance ... of navigating Iran's political minefield."
Rohani himself called for patience soon after his win was announced on Saturday. "The country's problems won't be solved overnight and this needs to happen gradually and with consultation with experts," he told the state news agency IRNA.
But Rohani, whose conciliatory style contrasts with the confrontational populism of Ahmadinejad, said there was a new chance "in the international arena for ... those who truly respect democracy and cooperation and free negotiation".
Post-election revellers were optimistic. "I am hopeful about the future, hopeful that we will have more social freedoms, more stability in Iran, better relations with other countries and hopefully a much better economy," said Hoda, 26, from Tehran.
As well as chanting "Long live Rohani!" and wishing good riddance to the current president with "Ahmadi, bye bye!", jubilant crowds did not shy from feting Mousavi, the reformist leader defeated in the election four years ago.
"Mousavi, Mousavi, congratulations on your victory!" the crowds shouted.
Pictures and videos of the celebrations showed more people wearing the green colours of Mousavi's 2009 campaign than Rohani's purple. Police stood by and even shared jokes with some people in the throng.
Others had an ironic take on the "Death to the Dictator!" chants of the huge 2009 protests, shouting "Thank-you Dictator!" for allowing a fair vote now.
Additional reporting by Yeganeh Torbati and Marcus George; Writing by Jon Hemming; Editing by Mark Heinrich