WASHINGTON (AP) — In a potentially history-shaping choice of diplomacy over confrontation, the U.S. and other world powers agreed Sunday to give Iran six months to open its nuclear sites to possible daily inspections in exchange for allowing Tehran to maintain the central elements of its uranium program, in a multi-layered deal to test Iran's claim that it does not seek atomic weapons.

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.

Also on HuffPost:

Loading Slideshow...
  • Raul Castro, President Of Cuba

    In this image from TV, US President Barack Obama shakes hands with Cuban President Raul Castro at the FNB Stadium in Soweto, South Africa, in the rain for a memorial service for former South African President Nelson Mandela, Tuesday Dec. 10, 2013. (AP Photo/SABC Pool)

  • Cristina Fernandez, President Of Argentina

    President Barack Obama meets with Argentina's President Cristina Fernandez at the G20 Summit in Cannes, France, Friday, Nov. 4, 2011. (AP Photo/Charles Dharapak)

  • Hamid Karzai, President Of Afghanistan

    Afghanistan President Hamid Karzai (L) and U.S. President Barack Obama shake hands after a joint news conference in the East Room of the White House on January 11, 2013 in Washington, D.C. (Photo by Chip Somodevilla/Getty Images)

  • Julia Gillard, Prime Minister Of Australia

    U.S. President Barack Obama (L) and Australian Prime Minister Julia Gillard shake hands during a bilateral meeting at Parliament House in Canberra on November 16, 2011. (JIM WATSON/AFP/Getty Images)

  • Dilma Rousseff, President Of Brazil

    U.S. President Barack Obama (L) shakes hands with Brazilian President Dilma Vana Rousseff (R) during a joint press conference at Palacio do Planalto in Brasilia on March 19, 2011. (JIM WATSON/AFP/Getty Images) <em><strong>CORRECTION:</strong> The title of this slide initially referred to Dilma Rousseff as the prime minister of Brazil. In fact, she is the president of Brazil.</em>

  • Hun Sen, Prime Minister Of Cambodia

    U.S. President Barack Obama (L) and Cambodian Prime Minister Hun Sen (R) reach out to shake hands on arrival at the Peace Palace for the Association of Southeast Asian Nations (ASEAN) and US summit in Phnom Penh on November 19, 2012 following the 21st ASEAN Leaders Summit. (ROMEO GACAD/AFP/Getty Images)

  • Stephen Harper, Prime Minister Of Canada

    President Barack Obama shakes hands with Canada’s Prime Minister Stephen Harper in bilateral meeting during the G20 Summit, Tuesday, June 19, 2012, in Los Cabos, Mexico. (AP Photo/Carolyn Kaster)

  • Sebastian Pinera, President Of Chile

    U.S. President Barack Obama greets Chilean President Sebastian Pinera before a dinner at the Washington Convention Center during the Nuclear Security Summit in Washington, DC, on April 12, 2010. (JEWEL SAMAD/AFP/Getty Images)

  • Xi Jinping, President Of China

    U.S. President Barack Obama shakes hands with then-Chinese Vice President Xi Jinping during meetings in the Oval Office of the White House in Washington, DC, February 14, 2012. (SAUL LOEB/AFP/Getty Images)

  • Juan Manuel Santos, President Of Colombia

    Colombia President Juan Manuel Santos (R) and U.S. President Barack Obama shake hands during a joint press conference in the framework of the VI Summit of the Americas at Casa de Huespedes in Cartagena, Colombia, on April 15, 2012. (SAUL LOEB/AFP/Getty Images)

  • Laura Chinchilla, President Of Costa Rica

    President Barack Obama and Costa Rica's President Laura Chinchilla shake hands at the end of their joint press conference in San Jose, Costa Rica, Friday, May 3, 2013. (AP Photo/Moises Castillo)

  • Francois Hollande, President Of France

    President Barack Obama shakes hands with French President Francois Hollande on arrival for the G8 Summit Friday, May 18, 2012 at Camp David, Md. (AP Photo/Charles Dharapak)

  • Angela Merkel, Chancellor Of Germany

    U.S. President Barack Obama (R) shakes hands with German Chancellor Angela Merkel looks after a joint press conference following their meeting in the East Room of the White House in Washington, D.C., on June 7, 2011. (JEWEL SAMAD/AFP/Getty Images)

  • Giorgio Napolitano, President Of Italy

    President Barack Obama shakes hands with Italian President Giorgio Napolitano during their meeting in the Oval Office of the White House in Washington, Friday, Feb. 15, 2013. (AP Photo/Jacquelyn Martin)

  • Shinzo Abe, Prime Minister Of Japan

    President Barack Obama shakes hands with Japan's Prime Minister Shinzo Abe in the Oval Office of the White House in Washington, Friday, Feb. 22, 2013. (AP Photo/Charles Dharapak)

  • Park Geu-Hye, President Of South Korea

    President Barack Obama and South Korea President Park Geun-Hye shake hands at the conclusion of their joint news conference in the East Room of the White House in Washington, Tuesday, May 7, 2013. (AP Photo/Pablo Martinez Monsivais)

  • Enrique Pena Nieto, President Of Mexico

    President Barack Obama, left, and Mexico President Enrique Pena Nieto, right, shake hands following a news conference at the Palacio Nacional in Mexico City, Thursday, May 2, 2013. (AP Photo/Pablo Martinez Monsivais)

  • Benigno Aquino, President Of The Philippines

    U.S. President Barack Obama (R) shakes hands with President Benigno Aquino of the Philippines in the Oval Office at the White House on June 8, 2012 in Washington, D.C. (Photo by Kevin Dietsch-Pool/Getty Images)

  • Donald Tusk, Prime Minister Of Poland

    Polish Prime Minister Donald Tusk (R) shake hands with U.S. President Barack Obama (L) during their meeting in Warsaw on May 28, 2011. (JANEK SKARZYNSKI/AFP/Getty Images)

  • Sheik Hamad bin Khalifa Al Thani, Amir Of Qatar

    President Barack Obama shakes hands with Sheik Hamad bin Khalifa Al Thani of Qatar during their meeting in the Oval Office of the White House in Washington, Tuesday, April 23, 2013. (AP Photo/Pablo Martinez Monsivais)

  • Traian Basescu, President Of Romania

    U.S. President Barack Obama (R) greets Romania's President Traian Basescu before a dinner at the US Ambassador's residence in Prague on April 8, 2010. (JEWEL SAMAD/AFP/Getty Images)

  • Vladimir Putin, President Of Russia

    President Barack Obama shakes hands with Russia’s President Vladimir Putin in a bilateral meeting during the G20 Summit, Monday, June 18, 2012, in Los Cabos, Mexico. (AP Photo/Carolyn Kaster)

  • Abdullah bin Abdulaziz Al Saud, King Of Saudi Arabia

    U.S. President Barack Obama shakes hands with King Abdullah bin Abdulaziz Al Saud of Saudi Arabia during meetings in the Oval Office at the White House in Washington, DC, June 29, 2010. (SAUL LOEB/AFP/Getty Images)

  • Lee Hsien Loong, Prime Minister Of Singapore

    President Barack Obama shakes hands with with Singapore Prime Minister Lee Hsien Loong during their meeting in the Oval Office of the White House in Washington, Tuesday, April, 2, 2013. (AP Photo/Pablo Martinez Monsivais)

  • Fredrik Reinfeldt, Prime Minister Of Sweden

    U.S. President Barack Obama shakes hands with Sweden's Prime Minister Fredrik Reinfeldt (L) during meetings in the Oval Office of the White House in Washington, DC, November 2, 2009. (SAUL LOEB/AFP/Getty Images)

  • Yingluck Shinawatra, Prime Minister Of Thailand

    U.S. President Barack Obama, left, and Thai Prime Minister Yingluck Shinawatra shake hands following the conclusion of their joint news conference at Thai Government House in Bangkok, Thailand, Sunday, Nov. 18, 2012. (AP Photo/Pablo Martinez Monsivais)

  • Abdullah II, King Of Jordan

    FILE - In this March 22, 2013, file photo, President Barack Obama, left, and Jordan's King Abdullah II, right, shake hands following their joint new conference at the King's Palace in Amman, Jordan. (AP Photo/Pablo Martinez Monsivais, File)

  • Recep Tayyip Erdogan, Prime Minister Of Turkey

    U.S. President Barack Obama (R) shakes hands with Turkish Prime Minister Recep Tayyip Erdogan after their bilateral meeting in Seoul on March 25, 2012 on the eve of the 2012 Seoul Nuclear Security Summit. (JEWEL SAMAD/AFP/Getty Images)

  • David Cameron, Prime Minister Of Great Britain

    President Barack Obama shakes hands with Britain's Prime Minister David Cameron on arrival for the G8 Summit Friday, May 18, 2012 at Camp David, Md. (AP Photo/Charles Dharapak)

  • Hugo Chavez, Former President Of Venezuela

    Venezuelan President Hugo Chavez (R) gives a book, 'The Open Veins of Latin America' of Uruguayan writer Eduardo Galeano to US President Barack Obama (L) during a multilateral meeting to begin during the Summit of the Americas at the Hyatt Regency in Port of Spain, Trinidad April 18, 2009. (JIM WATSON/AFP/Getty Images)