developments to find a weak point or a failure to blame on the negotiators for betraying the leadership," said a former Iranian official, a relative of Khamenei.
The deal was in part the result of months of secret talks held with Iran in such out-of-the-way places as Oman, with U.S. officials using military planes, side entrances and service elevators to avoid giving the game away.
The talks, the most important contacts in more than three decades during which Iran branded the United States the "Great Satan" and the United States described Iran a part of an "axis of evil" that also included Iraq and North Korea, were confirmed by U.S. officials and a former Iranian official.
They illustrate a U.S. desire, dating to the start of Obama's administration in January 2009, to explore whether there might be a way to reconcile two nations that have been hostile since 1979 but were once allies.
According to the U.S. official, who spoke on condition of anonymity, key Americans involved in the effort were William Burns, the U.S. deputy secretary of state, and Jake Sullivan, the national security adviser to U.S. Vice President Joe Biden.
The two men, at times with other officials such as White House national security staff member Puneet Talwar, met Iranian officials at least five times this year, the official said.
Burns, Sullivan and technical experts arrived in Muscat, Oman in March on a military plane - a way to preserve secrecy - to meet Iranians, the official added.
That was months before the election of Rouhani, a sign that Iranian officials were already coming round to the idea of talks before he took power.
Rouhani defeated more hardline candidates based in part on hopes he would ease sanctions that had taken an increasing severe toll on the Iranian economy since they were sharply tightened by the United States and European Union to hit Iran's crucial oil exports since 2011.
A former nuclear negotiator, Rouhani replaced the combative Mahmoud Ahmadinejad. But ultimately no negotiations would have been possible without a nod from the supreme leader, Khamenei.
"The leader gave the green light but was not optimistic about