Iran's supreme leader Ayatollah Ali Khamenei warned that "some" world powers are not to be trusted
Tehran (AFP) - Ayatollah Ali Khamenei's distrust of the United States loomed over nuclear talks for years but Iran's supreme leader ultimately did a deal because it served the nation's interests.
Faced with conflicting pressures over a US-led agreement -- needed to end crippling Western sanctions but deeply at odds with Iran's revolutionary rhetoric -- he kept everyone guessing whether diplomacy would ever yield results.
Hardliners in Tehran, brought up on chants of "Death to America", have repeatedly voiced opposition to the quest for a deal with a power derided as the "great Satan" ever since the Islamic revolution of 1979.
But to the millions of Iranians born since the overthrow of the US-backed shah, the international isolation and fear of war borne of the 13-year nuclear standoff have stalked their lives.
Khamenei heard both audiences but the overriding factor that led him to the deal announced in Vienna on Tuesday, was the need to end the sanctions that have pulverised Iran's economy, analysts say.
"It is not a case of the leader trusting the United States or the other countries in the negotiations, but he wanted to solve this problem," said Amir Mohebbian, a political strategist close to Iran's leadership.
"This nuclear deal makes the management of Iran easier for future leaders. He has shown that he leads rationally and pragmatically and the deal may also manage to change the face of the country."
In numerous speeches Khamenei appeared ambiguous about the nuclear talks, consistently talking down chances of a deal but at the same time praising Iran's negotiators as trustworthy and brave.
Whether as a negotiating tactic or as an effort to assuage hardliners, he maintained the balancing act.
- Pragmatism trumps rhetoric -
But pragmatism is what Iranian officials say guides Khamenei, supreme leader since 1989 and soon to turn 76.
In that regard, he is following in the footsteps of his predecessor, the Islamic republic's late founder Ayatollah Ruhollah Khomeini, who in 1988 reluctantly ended an eight-year war with now executed dictator Saddam Hussein's Iraq.
Khomeini described the acceptance of a UN ceasefire as "worse than drinking poison", but Iran's economy flourished afterwards. The current government hopes the same will happen after the nuclear deal.
Rather than representing submission to the West, the agreement is likely to consolidate Khamenei's rule, according to Davoud Hermidas Bavand, a veteran political analyst at Tehran University.
And whatever the evident contradictions of a pact with the "the great Satan", the core of Iran's nuclear programme has been preserved.
The domestic imperative to end the deadlock was ultimately more important, Bavand said.
"Ordinary Iranians felt involved in the negotiations and the leadership recognised that," he said. "Economic sanctions had a huge impact on the population, more than on the regime."
The accord may also allow Khamenei to claim victory over Iran's regional foes, who accuse Tehran of malign military intent and a regional power grab.
"It probably amounts to a marginal win over Israel, Saudi Arabia and even Turkey," said Bavand, describing the nuclear deal as a step forward for a war-wracked Middle East.
"In coming years it may well be seen as the measure that reduced regional tensions."
- A new diplomacy? -
The nuclear talks have signalled Iran's determination to escape the pariah status it endured under Rouhani's hardline predecessor Mahmoud Ahmadinejad.
Rouhani's eloquent foreign minister, the smiling, US-educated Mohammad Javad Zarif, personified the change in tone as head of Iran's negotiating team.
Zarif said an accord could lead to cooperation between Iran and the West against Sunni Muslim extremists of the Islamic State group, who from their base in Iraq and Syria have launched attacks against both Shiite and Western targets.
But ultimately, it was Khamenei who made a nuclear deal possible. As supreme leader he has the final word on all matters of state.
By approving secret talks with Washington in 2012 that led to formal negotiations with the P5+1 group -- Britain, China, France, Russia and the United States plus Germany -- he kickstarted a previously stalled diplomatic process.
The lessons of the Iran-Iraq war were a major influence, said Dr Siavush Randjbar-Daemi, a lecturer in Iranian history at the University of Manchester.
Not only are some of the same top officials involved -- Khamenei was then president, Rouhani was in charge of Air Command and Zarif worked on the UN ceasefire resolution -- but the country was under pressure and a solution, however difficult, was needed.
"The deal might not be the most heartfelt decision, but it is the most expedient one, even if that meant negotiating directly with the United States, despite all the mutual mistrust and suspicion," said Randjbar-Daemi.
"Iran has offered concessions but it has also obtained key benefits, namely full acceptance of a domestic nuclear programme, sanctions relief and an international role and position far less isolated than in 1988-89," he added.