This weekend's nuclear deal with Iran may have come together after two short rounds of negotiation in Geneva, but it's been long in the making.
For months leading up to negotiations between Iran and world powers in Geneva this month, Deputy Secretary of State William Burns and Jake Sullivan, national security adviser to Vice President Joe Biden, quietly held at least five meetings with Iranian officials, a senior Obama administration official told ABC News.
The meetings began in March, and they followed exploratory, back-channel talks about setting up higher-level meetings.
Burns, Sullivan and a team of technological experts discussed Iran's nuclear program with senior Iranian officials at meetings in Oman and Geneva. They also met in New York City during the United Nations General Assembly, which convened in September and October.
Those secret talks unfolded as relations warmed publicly for the first time in decades.
In late September, as the U.N. General Assembly convened in New York, Secretary of State John Kerry met, one on one, with Iranian Foreign Minister Javad Zarif -- even as experts warned that contact between Iran and the U.S. would prove politically difficult for both sides at home.
President Obama and Iranian President Hassan Rouhani spoke via telephone in late September, marking the first direct conversation between American and Iranian leaders since the 1979 Islamic revolution and ensuing hostage crisis that turned relations between the two countries toxic.
Back-channel communications had been going on for years between Washington and Tehran, but diplomacy gained momentum with the election in June of Rouhani, a self-declared moderate with a mandate from Iran's clerical leadership to seek a deal with world powers to ease financial and trade sanctions that have shrunk the nation's economy.
Sullivan, Burns and their team of experts met with senior officials from Iran.
Meanwhile, Jeffrey Feltman, the former top American diplomat in the Middle East and current U.N. under-secretary-general for political affairs, visited Tehran several times since leaving the State Department last year and met with Ayatollah Khamenei, the most powerful figure in Iran.
American and Iranian officials were aided by Oman's Sultan Qaboos bin Said, a longtime and well-known intermediary, who hosted the Americans and Iranians for talks. He also made a rare trip to Iran in late August to meet with Khamenei.
President Obama personally authorized the talks and sent Burns, Sullivan and five other officials to meet with Iranian counterparts in Muscat, Oman.
Public contact has posed political challenges on both sides.
In Iran, anti-American sentiment and the influence of hardliners has made talking to U.S. officials politically risky for Iranians. In the U.S., President Obama was criticized in his first presidential campaign for pledging openness to communicate with Iran. His opponent, Sen. John McCain, R-Ariz., infamously joked about bombing Iran at a campaign event, and Republicans have accused Obama of naivete when it comes to dealing with the Islamic republic.
After those secret dealings, the Obama administration has its deal -- a "first step" agreement for Iran to halt and roll back key parts of is nuclear program for six months, with the intent of a broader deal being hammered out in the interim.
Israeli Prime Minister Benjamin Netanyahu has criticized the deal, as have congressional Republicans.
House Majority Leader Eric Cantor, R-Va., the highest-ranking Jewish politician in the U.S., who called the Obama administration "very naive" last week for its movement toward a deal, expressed pause in response to the news that an agreement had been reached.
"While I await specific details of the interim agreement, I remain concerned that this deal does not adequately halt Iran's enrichment capabilities," Cantor said in a statement. "Numerous U.N. Security Council resolutions have called for the full suspension of Iran's nuclear activities, so it is troubling that this agreement still permits the Iranians to continue enriching. It is critical that distrust but verify be the guiding principle with which we approach this agreement."
Sen. Marco Rubio, R-Fla., meanwhile, called the agreement a "blow to our allies."
"This agreement will not 'freeze' Iran's nuclear program and won't require the regime to suspend all enrichment as required by multiple U.N. Security Council resolutions," Rubio said in a statement.
ABC News' Arlette Saenz and Christiane Amanpour contributed to this report.