The deal is a tentative first step easily presented as a win-win: Iran gives a little on nuclear enrichment and gets some economic sanctions relief in return, as its amiable president waxes diplomatically about continued trust-building with Washington. But America's closest Mideast ally, Israel, called it a "historic" mistake, fearing that by not insisting on an actual rollback the world has effectively accepted Iran as a threshold nuclear weapons state. Saudi Arabia and several other Gulf Arab states close to the U.S. hold similar views and many in Congress are dead set against a deal that allows Iran to continue to enrich uranium.
The marathon talks in Geneva appeared at times to be a study in Internet-age brinksmanship and public diplomacy - with all sides sending out signals and statements by Twitter and Facebook - but they also were the culmination of a painstaking process of old-school contacts and secret sessions between Iranian and American envoys that began even before the surprise election of Iran's moderate-leaning President Hassan Rouhani last June.
The shadow dialogue, mediated by mutual ally Oman, was so sensitive that it was kept from even close allies, such as negotiating partners at the nuclear talks, until two months ago, according to details obtained by The Associated Press and later confirmed by senior administration officials. The pace of the back-channel contacts picked up after Rouhani officially took office in August, promising a "new era" in relations with the West.
"Today, that diplomacy opened up a new path toward a world that is more secure - a future in which we can verify that Iran's nuclear program is peaceful and that it cannot build a nuclear weapon," President Barack Obama said in a weekend White House address. Obama referred to publicly known contacts between his administration and Iran and did not specifically confirm the clandestine talks. Senior administration officials, though, told the AP that at least five such meetings were held with Iran since March. Four of those took place after Rouhani's inauguration and produced significant chunks of the eventual agreement.
But even the extensive groundwork couldn't clear away all the obstacles to a deal during make-or-break moments in Geneva. The snags were the same that have been at the heart of the impasse since public negotiations resumed 18 months ago: Whether to permit Iran to keep its ability to enrich uranium, the central process in making nuclear fuel for energy-producing reactors and, at higher levels, weapons-grade material.
Iran insisted that trying to block its enrichment was a dead end. For Iran's leaders, self-sufficiency over the full scope of its nuclear efforts - from uranium mines to the centrifuges used in enrichment - is a source of national pride and a pillar of its self-proclaimed status as a technological beacon for the Islamic world.
In the end, Iran agreed to cap its enrichment level to a maximum of 5 percent, which is well below the 90 percent threshold needed for a warhead. Iran also pledged to "neutralize" its stockpile of 20 percent enriched uranium - the highest level acknowledged by Tehran - by either diluting its strength or converting it to fuel for its research reactors, which produced isotopes for medical treatments and other civilian uses.
"For the first time in nearly a decade, we have halted the progress of the Iranian nuclear program, and key parts of the program will be rolled back," Obama said, stressing that any sanctions relief is reversible should Iran fail to comply with the deal.
What Iran received in return was a rollback in some sanctions - a total package estimated by the White House at $7 billion back into the Iranian economy - but the main pressures remain on Iran's oil exports and its blacklist from international banking networks during the first steps of the pact over the next six months.
Still, Rouhani portrayed the accord as a victory for Iran's "right" to enrichment under the Nuclear Non-Proliferation Treaty - even though the West sidestepped using that language in the documents and foreign ministers, including Secretary of State John Kerry, flatly denied such a right had been recognized.
"No matter what interpretive comments are made, it is not in this document," Kerry told reporters in Geneva. "There is no right to enrich within the four corners of the NPT. And this document does not do that."
Rouhani, however, using similar phrasing, said the exact opposite.
"No matter what interpretations are given, Iran's right to enrichment has been recognized," he said in a nationally televised speech from Tehran just hours after the deal was signed. Rouhani then posed with family members of nuclear scientists murdered in recent years, killings Iran has blamed on Israel and its allies.
Later, a group of young people gathered to give Rouhani's envoys, including U.S.-educated Foreign Minister Mohammad Javad Zarif, a hero's welcome.
Securing a deal that keeps enrichment in place also gives Rouhani's government some breathing room from Iranian hardliners, such as the powerful Revolutionary Guard, who were so dismayed by the talks and the overtures to Washington that they erected giant banners in Tehran earlier this month depicting U.S. envoys as holding position papers in one hand and attack dogs in the other.
But Rouhani still has the backing of Iran's top authority, Ayatollah Ali Khamenei, whose approval is needed for all key policy moves, possibly even the secret diplomatic exchanges with Washington.
Obama, however, has no such shield from his critics. They immediately piled on, led by Israeli Prime Minister Benjamin Netanyahu and senior members of Congress from both parties. That underscored the challenges ahead to win over those who are outright hostile to the deal.
In Jerusalem, Netanyhu called the agreement a blunder of "historic" proportions that leaves Iran as a perpetual nuclear threat.
"Today the world became a much more dangerous place," Netanyahu said, reiterating a long-standing threat to use military action against Iran if needed, declaring that Israel "has the right and the duty to defend itself by itself."
The White House said Obama called Netanyahu on Sunday and emphasized "the United States will remain firm in our commitment to Israel, which has good reason to be skeptical about Iran's intentions."
In Washington, congressional critics, many of them staunch supporters of Israel, pounced.
Lawmakers from both parties said they were skeptical that Iran will stick to a new nuclear deal and want Congress to prepare beefed-up economic penalties to hit Tehran if the accord falls apart.
The chairman of the Senate Foreign Relations Committee, Democratic Sen. Bob Menendez of New Jersey, said he would work with colleagues to have sanctions against Iran ready "should the talks falter or Iran fail to implement or breach the interim agreement."
Sen. Chuck Schumer, D-N.Y., said he was "disappointed" by the deal, which he called disproportional. He said sanctions forced Iran to negotiate in the first place. "This agreement makes it more likely that Democrats and Republicans will join together and pass additional sanctions when we return in December," Schumer said.
Sen. Marco Rubio, R-Fla., agreed. "There is now an even more urgent need for Congress to increase sanctions until Iran completely abandons its enrichment and reprocessing capabilities." he said.
Rep. Mike Rogers, the Michigan Republican who chairs the House intelligence panel, was more critical of a deal he said aids "the leading nation state of terror."
"We have just rewarded very bad and dangerous behavior," he said.
In addition to cutting back on enrichment, Iran agreed to halt work on a planned heavy water reactor in Arak, southwest of Tehran. Heavy water is a compound used to cool nuclear reactors, which do not need enriched uranium to operate. Heavy water reactors also produce a greater amount of plutonium as a byproduct, which could be used to make warhead material. Iran does not currently possess the technology to extract the plutonium, and promised in Geneva not to seek it.
The deal gives inspectors from the U.N.'s nuclear watchdog agency, the International Atomic Energy Agency, faster and broader access to Iran's atomic facilities and obligates Iran to address all U.N. Security Council concerns, including those around the Parchin military compound outside Tehran. Parchin has been suspected of housing a secret underground facility used for Iran's nuclear program, a claim denied by Iran. U.N. nuclear inspectors twice visited the site, but seek a third tour.
For Iran, the deal does not mark a major rollback of sanctions, as it will still face widespread blocks from international banking networks and oil sales, which have cut the country's main currency source by more than half.
It does, however, offer some sanctions easing on gold and other precious metals, Iran's automobile and aviation industries and petrochemical exports. The world powers at the talks - the five permanent U.N. Security Council members plus Germany - further agreed to hold off any new nuclear-related sanctions for at least six months in exchange for Iranian adherence to the deal.
It also opens up $4.2 billion from oil sales to be transferred in installments over the next six months as various compliance stages are reached. That's still a very small sum in a country that was once one of OPEC's top exporters.
The White House estimated the total benefit for Iran at about $7 billion, which was described as a "fraction" of the financial hit from sanctions over the half-year period.
Murphy reported from Dubai, United Arab Emirates.