Indira A.R. Lakshmanan was for the past seven years a senior correspondent covering foreign policy for Bloomberg News, traveling with Secretaries of State Hillary Clinton and John Kerry. She has covered domestic politics and international relations for 25 years and reported from more than 80 countries.

They made 69 trips across the Atlantic together and celebrated nearly everyone’s birthday at least once overseas, far from their own families. Sleep-deprived and sometimes giddy, the U.S. team negotiating a nuclear deal with Iran imagined which Hollywood star would play them if the movie were ever made: They cast Ted Danson as Secretary of State John Kerry, Javier Bardem as Energy Secretary Ernest Moniz, and Meryl Streep as State Department negotiator Wendy Sherman. Along the way, they suffered no shortage of casualties: Sherman broke her nose in Vienna when she crashed into a glass door late at night running to brief Kerry on a secure phone, and her pinky finger rushing from one classified briefing to another. Kerry, incensed after Iranian backtracking in May, slammed his hand on a table, sending a pen flying across the room at an Iranian deputy foreign minister, and then shattered his leg in three places after he slammed his bike into a curb the next day, frustrated and distracted.

The U.S. team was skeptical for most of the two years they were at it that they ever would close the deal. Sherman, the detail-oriented workhorse of the talks who was caricatured as a deceptive fox by an Iranian cartoonist—prompting her aides to make “Team Silver Fox” T-shirts in a nod to her wave of white hair—compared the challenge to unscrambling a Rubik’s Cube, since no issue could be solved in isolation.


On each trip, Sherman started a tradition of going around the table at a team dinner in various European cities—De Capo Pizzeria in Vienna was the crowd favorite—and asking each official what odds they placed on reaching a final accord. At almost every gathering, most guesses were below 50 percent. A veteran nonproliferation expert who had negotiated with the Soviets kept his guesses to the low single digits till the very end. Richard Nephew, a sanctions expert, was sometimes 50 points above every bet, alone in believing that economic pressure forced Iran to the table and made a final deal just a matter of time. Sherman never voted.

Last week, against long odds, the deal that even President Barack Obama doubted would come together until the final days of negotiations in Vienna cleared its final hurdle in Washington.

Despite a well-funded summer campaign by groups like the American Israel Public Affairs Committee, opponents were unable to muster enough lawmakers to block the deal by last week’s September 17 deadline for congressional review. The accord designed to block Iran from acquiring a nuclear weapon in exchange for lifting crippling economic sanctions goes forward, with adoption day expected October 18, when Iran is to begin curtailing its various nuclear activities for 10 to 25 years. The historic deal sealed between Iran and the so-called P5+1—the United States, the United Kingdom, Russia, France, China and Germany—alters Iran’s relationship with the world and, for better or worse, represents the cornerstone of Obama’s foreign policy legacy.

Covering the path to that deal was the main focus of my beat at Bloomberg News for the past seven years. I traveled more than 140,000 miles and spent months at hotels in Europe, New York, the Middle East and Central Asia, reporting on talks by Kerry and U.S. nuclear negotiators. Now that the deal is done, 12 current and former Obama administration officials intimately involved in the negotiations spoke to me last week, revealing new details for the first time. This story of the behind-the-scenes calculations along a seven-year road to a deal is based upon those accounts, as well as on hundreds of hours of reporting on the talks I did as they unfolded in recent years in capitals across three continents.

Interviews with officials from the White House and the Departments of State, Energy and Treasury point to multiple inflection points along the way: the exposure of a covert Iranian nuclear facility; Iran’s rejection of a nuclear fuel-swap backed by world powers; the $54 billion Iran lost in one year of oil sanctions. Those factors precipitated two other turning points: Obama’s decision to greenlight secret talks and the election of President Hassan Rouhani, who won on a pledge to resolve the nuclear crisis and get sanctions lifted.

Over the past two years, negotiators and experts from U.S. nuclear laboratories spent countless hours sketching nuclear “break-out” scenarios on white boards that were wiped clean daily to protect intelligence. There were back-to-back all-night negotiations fueled by hundreds of espresso pods and 60 pounds of strawberry Twizzlers, string cheese and mixed nuts in the final month alone. There were near-breakdowns and eventual breakthroughs to get the deal that even Obama acknowledged was no more than 50 percent likely until the final days.

The first step toward the most significant and hard-fought diplomatic achievement of Obama’s presidency began with an uncomfortable night in a vacant house far from Washington, D.C.

***

In early July 2012, Obama’s senior White House adviser on Iran, Puneet Talwar, and Secretary of State Hillary Clinton’s right-hand man, Jake Sullivan, arrived in the sleepy Arabian sultanate of Oman, 150 miles across sparkling Gulf waters from the Iranian coast. It was the first significant back-channel contact with Tehran since the disastrous Iran-Contra scandal three decades earlier, and the two trusted envoys dispatched by the president were keenly aware they couldn’t repeat that debacle. The stakes were high after years of futile diplomacy, mounting economic sanctions and warnings of military options had failed to halt Iran’s defiant nuclear progress. With deep distrust, historical grievances and toxic third-rail politics in both Washington and Tehran, the rendezvous had to be top-secret or it would be doomed before it started.

Image Scenes from a Diplomatic Breakthrough | Click to view a photo timeline of the Iran talks. | Pete Souza/Instagram

To conceal their presence, Talwar and Sullivan crashed on couches in an empty U.S. embassy residence in the Omani capital of Muscat rather than risk being spotted in a hotel. Sultan Qaboos bin Said Al Said promised absolute discretion, and with the mercury just shy of a 115-degree record set a few days earlier, there was little chance any reporter would be staking out the palace.

Four Americans—Talwar, Sullivan, a White House logistics specialist and a translator—sat across from four Iranians at a massive burl wood table large enough for a Cabinet meeting. With its soaring ceiling and crystal chandeliers, the immense salon was hardly an intimate setting for a delicate first encounter.

The Iranians wanted an understanding up front that the U.S. would recognize their “right” to enrich uranium. The Americans said no. They were willing to listen to the Iranians, but they had their own concerns, including the regime’s repeated violations of United Nations resolutions and International Atomic Energy Agency suspicions that Iran was seeking a nuclear weapon.

More clandestine meetings followed the next year, this time in a private seaside villa of the sultan, a discreet setting that kept the negotiations secret even from Washington’s nervous and watchful allies in nearby Israel and Saudi Arabia. The talks paved the way to an interim freeze on Iran’s most sensitive nuclear activities in November 2013. That laid the groundwork for a comprehensive, long-term deal reached July 14, three years to the month after that first secret contact. But the path to get there was anything but smooth.

The Oman meeting was the first U.S.-Iranian, face-to-face contact, but the diplomatic process began in the first minutes of Obama’s presidency. On January 20, 2009, he used his inaugural address to tell Iran and other longtime foes that he was willing to “extend a hand” if they were willing “to unclench your fist.” Within days, the new president instructed advisers to undertake a strategic review of U.S. policy toward Iran, which took six weeks. The State Department brainstormed over how to restart stalled nuclear talks; the Treasury Department studied how to squeeze Iran financially; the Pentagon reviewed force posture and military options. Intelligence officers are said to have disrupted Iranian weapons flows to terrorists, accelerated cyber warfare to disable Iranian centrifuges, and increased surveillance—leading to the discovery of a covert underground Iranian nuclear facility.

The president initially prioritized diplomatic outreach. He needed to convince allies who felt bulldozed by President George W. Bush that the new U.S. leader would attempt diplomacy before resorting to punitive measures or military force. “President Obama was proceeding from the logic that we needed to remove Iran’s excuses and show them to be the obstacle,” says one former White House official who, like most of the others interviewed for this story, spoke on condition of anonymity to be candid about delicate international diplomacy.

In March, Obama recorded a YouTube message to the Iranian people to mark the Persian New Year. In the Nowruz greeting—the brainchild of a junior State Department employee named Erica Thibault—Obama became the first U.S. president to refer to the longtime adversary as “the Islamic Republic of Iran,” the country’s official name ever since the 1979 revolution that ruptured relations with the U.S. and saw American diplomats held hostage for 444 days. European allies and reform-minded Iranians praised Obama’s video for setting a new tone after decades of enmity.

Within a month, Oman, which enjoyed friendly ties with both the U.S. and Iran, quietly offered to broker talks between the longtime foes. It was one of several offers from would-be intermediaries including Japan, Switzerland and private envoys. The White House politely declined, hopeful that the first African-American president—who had won the Nobel Peace Prize for campaigning to restore U.S. diplomacy and moral leadership—might break through decades of enmity himself.

At the same time, the so-called P5+1—the five original nuclear powers and permanent members of the United Nations Security Council, plus Germany—sent an April letter inviting Iran to restart nuclear talks that had gone nowhere in the previous six years, as Iran installed more centrifuges and boosted its stockpile of enriched uranium.

“The idea was if direct engagement works, great. If not, no one can claim we’re not trying, and we can use that as a cudgel to expand sanctions and pressure on Iran,” says Richard Nephew, a former senior sanctions negotiator who worked on Iran from 2004-2014 at the Department of Energy, the White House and the State Department. “The crazy idea of the Bush administration was that suspension of enrichment was a precondition for talks. We changed that because it was just upsetting our friends and partners and giving them an easy excuse to avoid sanctions.”

Iran has always insisted its atomic program is for civilian energy and medical research and that alleged evidence of work toward a nuclear weapons capability was falsified. Yet over the past 12 years, Iran had failed to address concerns of the U.N.’s International Atomic Energy Agency about potential military dimensions of its program.

Weeks before Iran’s June 2009 presidential election, Obama penned a secret letter to Iran’s Supreme Leader Ayatollah Ali Khamenei, hoping to open dialogue. Khamenei responded, but soon, Iran was in turmoil over stolen elections and a violent government crackdown on the so-called Green Revolution. “I don’t know if there was any receptiveness on Khamenei’s part to Obama’s diplomacy, but if there ever was, the Green Revolution turmoil pretty much killed that,’’ says Gary Samore, who served as Obama’s nonproliferation adviser.

Suddenly, with images beamed around the world of government-backed thugs attacking peaceful protesters, “it was a hell of a lot easier to talk about sanctions in Europe than when it was just a dry nuclear issue,” Nephew recalls.

A month later, three Americans who strayed across an unmarked border while hiking in Iraq were taken into Iranian custody and accused of espionage, complicating any U.S. outreach over the nuclear question.

By September, Western intelligence discovered Iran had secretly built a fortified nuclear facility called Fordo, dug into a mountain near the holy city of Qom. An outraged Obama stood shoulder-to-shoulder with the French and British leaders, condemning the Iranian deception to the world during a G-20 leaders’ meeting on September 25 in Pittsburgh.

President Obama's 2009 Nowruz message.

Weeks later, Iran rejected an offer that it had solicited and earlier agreed to for the international community to supply nuclear fuel plates it needed for its medical research reactor. “The failure of the Tehran Research Reactor deal was a major inflection point,’’ says Nephew. Frustrated that diplomacy had come to naught, Obama was ready to switch to the pressure track, targeting Iran’s economy.

By February 2010, Iran had started to enrich uranium to nearly 20 percent in the underground bunker at Fordo. Though the enrichment was ostensibly for use in its medical reactor, Tehran had inched one step closer to making bomb-grade fuel. Obama personally appealed to Russian President Dmitry Medvedev and Chinese President Hu Jintao to support a new U.N. Security Council resolution condemning Iran’s actions.

“We hit them with a Mack truck’s worth of sanctions from the 9th of June all the way through September of 2010,” Nephew recalls. “Every day, we wanted the supreme leader and [President Mahmoud] Ahmadinejad to wake up to a newspaper with bad economic news,” putting them under pressure to make nuclear concessions.

Amid the drumbeat of sanctions, there was one ray of hope. Sarah Shourd, one of the American hikers held for more than a year, was sent home thanks to intervention by the sultan of Oman. Obama’s closest advisers were impressed. For more than a year, Omani diplomats had been offering to broker a back channel to the Iranians over the nuclear program. But before investing in a high-risk endeavor, the president needed to be convinced Oman could deliver.

In November 2010, Dennis Ross, the White House’s Middle East coordinator, and Talwar made a secret visit to Muscat to meet Sultan Qaboos, who assured them he had a viable channel to Khamenei. Whether anything would come of it was another question.

Meanwhile, the international community’s effort to revive official talks ended in abject failure. The six powers met in Istanbul in January 2011, and the Iranian delegation insisted the world must accept their right to enrich uranium and drop all sanctions as a precondition for resuming talks. “That was the worst single meeting we had. It was shocking how ridiculous their position was,” recalls Robert Einhorn, who was then a State Department nuclear negotiator. “Everyone was outraged, including the Russians and the Chinese. It was over a year before we met with the Iranians again.”

Each passing month seemed to bring one step forward and one step back. In August, Iran convicted the two remaining U.S. hikers of espionage, before releasing them in September, again thanks to the efforts of the sultan of Oman.

That was the worst single meeting we had. It was shocking how ridiculous their position was.”

In a bizarre twist in October, U.S. authorities said they foiled an Iranian plot to assassinate the Saudi ambassador to Washington while he dined at Café Milano, a chic Georgetown restaurant. On November 11, the U.N.’s atomic energy agency suggested Iran was on a path to building a nuclear weapon.

Obama advisers were still hoping a direct channel to the Iranians might break the deadlock, and a new player entered the stage. John Kerry, then chairman of the Senate Foreign Relations Committee, made two undisclosed trips to Oman starting in December 2011 and came back convinced that the sultan had a viable channel to the supreme leader. Obama, Secretary of State Hillary Clinton and then-National Security Adviser Tom Donilon were skeptical, according to Kerry’s notes from the time. Two dozen phone calls between Kerry and Omani officials followed. Kerry came to believe “that the supreme leader was aware of and comfortable with the conversations and the kinds of constraints on Iran’s program that the U.S. would need,” a senior State Department official recalls.

By the end of 2011, frustration was at an all-time high on Capitol Hill and heated debates were underway over how to squeeze Iran to force concessions. At a cringe-inducing Senate Foreign Relations hearing in December, an apoplectic Robert Menendez, a New Jersey Democrat, lambasted Sherman and then-Treasury Undersecretary David Cohen for seven minutes straight, denouncing the administration’s failure in the face of Iran’s march to a nuclear weapon. Menendez and Illinois Republican Mark Kirk wanted to cut off Iran’s central bank and oil payments system from the global financial system. Administration officials told senators privately that could tank the world economy: Iran was a major crude supplier to U.S. allies in Asia and the European Union.

A revised bill demanded buyers slash oil imports from Iran or be cut off from the U.S. banking system. Obama signed it into law December 31, 2011, and State Department and Treasury officials spent the next six months persuading Iran’s biggest oil buyers—especially China, India and South Korea—to significantly reduce their imports.

In January 2012, the European Union voted to impose its own oil embargo on Iran, even though the decision was costly for those hard-hit by the recession. When the ban went into effect July 1 in tandem with U.S. sanctions, the effect was dramatic. Over the next 12 months, the number of countries buying Iran’s oil dropped from 21 to five. Iran lost an estimated $54 billion—more than half its annual revenue from its leading export.

Running in parallel for the first half of the year was a concerted effort to rekindle diplomacy, with the six powers meeting in Istanbul in April, in Baghdad in May and in Moscow in June. Each round flailed as the Iranians recited the same lecture—a history of grievances and an assertion of Iran’s nuclear “rights.”

Meanwhile, Talwar and Sullivan were in Muscat in July to open the secret back channel to Iran. The Omanis advised the Americans that tone, not just substance, mattered: the Iranians “had to be treated with respect and understanding—that was a continual piece of advice,” said a senior administration official who spoke on condition of anonymity. Iran sent foreign ministry diplomats, not the hard-line national security team that was running the official nuclear talks. But the Iranians kept insisting on their right to enrich uranium as a starting point.

Over the next six months, debate at the White House centered on whether to dangle an American willingness to consider limited Iranian enrichment with intrusive inspections, if Iran would accept strict curbs on its overall nuclear program.

Iran’s economy, meanwhile, was tanking as more and more sanctions on energy, banking, mining, ports, insurance and more piled on. New restrictions barred Tehran from repatriating oil earnings. Gross domestic product plummeted, inflation soared and the rial collapsed, fueling bank withdrawals, consumer panic and a black market for gold trade.

By early 2013, the nuclear program was no longer proceeding as quickly as it had over the previous two years because of a stranglehold of sanctions. But the U.S. and EU felt they were running out of viable options to tighten the screws without a boomerang impact on the world economy.

“We were getting to the point where we’d have to sanction the entire Iranian economy or pursue different pressure that would eventually lead down the military path,” Nephew recalls. “We knew the sanctions were going to stop having an effect. You can only get $54 billion away from them in a year of lost oil sales once.”

“They were having technical difficulties with their program, which was hamstrung by our sanctions. So we were facing one pressure—their nuclear clock was not being slowed enough by our sanctions clock. And they were facing another pressure— sanctions were strangling their economy, and their nuclear program wasn’t moving fast enough to give them any better leverage in the talks,” he says. Both sides, he says, “entered 2013 in a much worse place than we wanted to be.”

The result, according to several officials, was that both governments realized it was time for a change. “On their side, they were ready to accept restrictions on their nuclear program. On our side, we were willing to accept the idea of an Iranian enrichment program in the long term,” along with intrusive inspections and safeguards, Nephew says.

As those views were slowly taking shape in the White House and in Tehran, at the official negotiating table, talking points remained the same. The next round of P5+1 talks in Almaty, Kazakhstan, began in February 2013.

We knew the sanctions were going to stop having an effect. You can only get $54 billion away from them in a year of lost oil sales once.”

The Americans bemoaned that Iran’s then-lead nuclear negotiator, a hard-liner named Saeed Jalili, spent the bulk of the sessions lecturing on Iran’s rights and dignity, leaving little time to discuss practical nuclear solutions. Half the day was taken up by translations. Jalili droned on about the historical wrongs against Iran, while at the same time claiming the world was doing them a favor by sanctioning their economy, forcing them to become stronger and more self-sufficient.

Meanwhile, planning for the secret channel was proceeding in tandem. Hillary Clinton had been dubious at first but had backed the involvement of her trusted deputy chief of staff, Sullivan. By now she had left office, and Sullivan became Vice President Joe Biden’s national security adviser, staying on the Iran talks for the next two years.

On March 1, Deputy Secretary of State Bill Burns led a U.S. delegation to Muscat that included Sullivan, Talwar and Einhorn. They were transported on a noncommercial plane to ensure they wouldn’t be recognized, and met with the Iranians at the remote villa. They managed to agree on a two-step framework for negotiations. First, they would freeze some nuclear activities in exchange for limited sanctions relief. That would be a building block for a long-term deal.

In June 2013, Hassan Rouhani won the Iranian election with the backing of moderates on the promise of resolving the nuclear issue. At left, Rouhani shows his ink-stained finger to photographers after voting on election night. At right, Iranians celebrate his election in the street. | Getty

The EU, Russia and China were oblivious to the side channel, and the next round of P5+1 talks in Almaty went forward in April. A State Department official described a change in the atmosphere. Jalili and Sherman shared photos of their grandchildren, perhaps the first exchange of niceties that humanized the other side.

A month later, Kerry, who by now had succeeded Clinton as secretary of state, stopped in Muscat on an official visit to privately express his gratitude to the sultan for supporting the secret channel.

Then, in June, something happened that changed everything. Hassan Rouhani, a former Iranian nuclear negotiator, won the backing of moderates and was elected president on a promise to restore Iran’s economy and end his nation’s isolation by resolving the nuclear dispute once and for all.

A young cleric and follower of Ayatollah Ruhollah Khomenei during the Islamic revolution, Rouhani had credibility among the clerical establishment and the gravitas to talk directly to the supreme leader. At the White House, Obama’s closest advisers, including National Security Adviser Susan Rice, Chief of Staff Denis McDonough and Deputy National Security Adviser Ben Rhodes debated what his election would mean for talks.

“We weren’t certain then if anything would change,” admits one U.S. official. Rouhani had been a nuclear negotiator, he knew the system, he was savvy and he was unlikely to be bulldozed by the apparatus. But ultimately, it was up to the supreme leader to accept a nuclear compromise. Obama sent a congratulatory letter to Rouhani calling for progress in talks, and waited to see what happened.

After Rouhani’s inauguration, the change was immediate and almost dizzying, considering the lack of progress in the previous 4½ years. He selected a cadre of Western-educated diplomats, naming as foreign minister a smooth former ambassador to the United Nations with deep contacts in the U.S., Mohammad Javad Zarif. The MIT-educated physicist Ali Akbar Salehi, who as foreign minister had favored starting secret talks with the U.S., was put atop Iran’s atomic energy establishment. Overnight, new life was breathed into the diplomatic channel.

In August, at a third round of secret talks in Muscat—the first after Rouhani’s election—Burns said for the first time that the U.S. would be willing to consider limited enrichment with proper verification, inspections and curbs on Iran’s overall work. “Offering enrichment—that was the breakthrough moment,” says a senior administration official who was involved.

Trita Parsi, an advocate for the deal and author of the forthcoming Losing an Enemy: Obama, Iran and the Legacy of Diplomacy, rejects the critique that Obama caved in by accepting enrichment, or that any president could have gotten a better deal. “That’s like saying the Catholic Church made a ‘concession’ to Galileo. … Iran was already enriching, and they were never going back. Within the P5+1, the U.S. had almost no support for its zero enrichment demand,” Parsi says.

American negotiators acknowledge that’s true. “Everybody understood that talks weren’t going to move forward” if the U.S. didn’t agree to limited enrichment, the senior negotiator says, “but there were hundreds of other details that still had to be worked out.”

Another “key moment that was a harbinger of things to come was Secretary Kerry’s first meeting with Zarif. It was meant to be just a handshake,” a senior State Department official recalls. But Kerry, who puts a lot of stock in personal relationships as a key to diplomacy, pulled the Iranian into a side room next to the U.N. Security Council chamber and spent half an hour talking. They exchanged contacts, and Sherman and her staff shared emails and phone numbers as well. It was all part of setting “the foundation for what was obviously a very technical set of negotiations, but was also very much driven by relationships between the key principals,” the State Department official said.

Eighteen months after Kerry met Zarif, Moniz, the U.S. energy secretary, a nuclear physicist who taught at MIT while Iran’s atomic chief Salehi was a graduate student, was brought into the talks. He played up that connection, reminiscing with Salehi about Cambridge in the 1970s and bringing him an MIT baby onesie and other logo gifts when Salehi’s first grandchild was born.

Without that kind of personal outreach, “it would’ve been very hard to surmount 30 years of mistrust to work constructively with the people on the other side,” the State Department official says. As the working relationship grew, Kerry and Zarif, Moniz and Salehi, and Sherman and Iran’s deputy negotiators Abbas Araghchi and Majid Takht-Ravanchi were on a first-name basis.

Meanwhile, there had been discussions at the White House about whether Obama should shake hands with the new Iranian leader when he came to address the U.N. Though Rouhani’s rhetoric was conciliatory compared with that of his predecessors, he was still a stalwart of the Islamic revolution, and with an insatiable appetite for sanctions on Capitol Hill and no nuclear deal in sight, it was politically inconceivable. Instead, Obama placed a short phone call while Rouhani was on his way back to the airport. That small step became the highest-level contact between the nations since 1979.

The secret talks that began in Oman were now continuing in New York on the sidelines of the U.N. General Assembly. The teams were well along in drafting an interim agreement that would buy them time. The idea was to stop Iran’s most sensitive work—the enrichment of uranium to nearly 20 percent—and dramatically increase inspections in exchange for limited sanctions relief.

Kerry and Zarif's first meeting in September 2013 at U.N. Headquarters in New York. | Getty

The U.S. team arrived in Geneva in October for official nuclear talks that were now back on track with the Europeans, Chinese and Russians. Burns and Sullivan stayed in different hotels so they wouldn’t be spotted and used a back entrance to continue secret bilateral talks with Iranians. They now had a draft that was 75 percent done by the time they presented it to foreign ministers who were meeting in Geneva in early November. Sherman went to Israel to tell the government. The Israelis were upset the Americans had concealed the secret talks from them; U.S. officials suspect the Israelis knew by then, and they insist they were always transparent about the president’s determination to prevent Iran from getting a nuclear weapon and his diplomatic endgame.

For their part, Kerry’s counterparts among the six powers were shocked they had been kept in the dark, though some relished that so much progress had been made. Getting an accord in three months “was extraordinary, lickety-split” compared with the previous five years of circular talks, says Einhorn, who was involved in both the public and private diplomacy.

French Foreign Minister Laurent Fabius was miffed that the other powers who were toiling on the Iran nuclear file for a decade, long before the Americans joined, had been left out, and he denounced parts of the deal to the media. U.S. officials said at the time that his outburst was calculated to demonstrate France’s “relevance” and to portray France as taking a hard line. A deal couldn’t be sealed, and ministers went home, returning to Geneva three weeks later. Kerry, Zarif and Catherine Ashton, the then-EU high representative who coordinated the talks, stayed up well past midnight negotiating the details and announced the accord to an exhausted press corps in the middle of the night before jetting home.

Zarif had told his counterparts he had limited political capital in Tehran and had to deliver a final deal to end all sanctions within six months. The ministers gave themselves until late July 2014, never imagining it would take them an additional year beyond even that to seal the deal.

***

On January 20, 2014, the so-called Joint Plan of Action was adopted. It would hold Iran’s nuclear work in place and expand international monitoring in exchange for releasing $700 million a month from Iran’s frozen oil assets. It was a stopgap measure to give negotiators time and space to hash out the far more complicated final accord.

Before each important round of negotiations—the U.S. team made 11 trips to Vienna alone in 2014 and seven more this year—Obama would gather top negotiators to review his goals and red lines and assess progress in the talks. These sessions made the negotiators’ stance in the talks “easy,” one White House official explains, laying out the boundaries that would be acceptable back home in Washington. “The president has been insistent on his red lines from the beginning. He had a very clear concept from the start of what kind of a deal he could live with and what he couldn’t,” the official says. Obama’s goal was to ensure that for a minimum of a decade, Iran would remain at least one year away from amassing sufficient fissile material for a single bomb. “He really did trust Kerry completely on this, and would say, ‘I want you to come back to me if you have any uncertainty about meeting my red lines.’”

U.S. nuclear laboratory experts offered numerous permutations of how to achieve that goal. The formula was equal to a certain number of centrifuges plus a certain stockpile of low-enriched uranium. If one number went up, the other had to come down.

Obama insisted all of Iran’s paths to a nuclear weapon—uranium, plutonium or covert development—must be blocked. That meant coming up with solutions to modify the heavy-water reactor at Arak and to prevent enrichment at the underground Fordo facility that could be harder to detect and destroy in a military strike.

The president insisted on a “red team” of internal and external nuclear experts with security clearances to test the assumptions of a one-year breakout time against the most demanding audience. Israeli government nuclear scientists were asked for their input and judgment, and were very helpful, a senior administration official says.

Running parallel to the nuclear discussions was the sanctions negotiation—what pressure to relieve and when. The White House decided no further sanctions would be eased until a final deal was accomplished, and penalties would be waived once the U.N.’s atomic agency verified Iran had curbed its program as promised.

Ahead of every new round, the president would summon Kerry, Moniz and Sherman to remind them, “ʻYou have my guidance and my red lines and I want you to know that you are empowered to walk away, I have no problem with that,’” recounts a senior official who attended the meetings.

Given the mind-bending challenge to make all the parts match up, Sherman adopted the mantra that “nothing is agreed till everything is agreed,” and routinely compared the challenge to solving a Rubik’s Cube, when one side inevitably gets messed up, forcing the puzzle-solver to find a new solution. Energy Department scientist Kevin Veal ordered 40 colorful Rubik’s Cubes imprinted with their difficult tasks, and Susan Rice, Kerry and his chief of staff, Jon Finer—who were spending almost as much time on the Iran deal as the experts—got them too. By the end, the negotiators were virtually living in Vienna, and their one bit of freedom was a choice among a handful of approved hotels—some favored the Marriott for its gym, others preferred the Imperial or the Bristol for old world ambiance and Austrian cuisine.

Sherman traveled so often for nuclear talks that by 2013 she had already been awarded lifetime status in United Airlines’ Global Services program, an invitation-only perk for the world’s top frequent flyers. She and her team were escorted personally by a United VIP concierge at each connection (I was allowed to tag along when I was on the same flight). It was hardly a glamorous life, though; the government only pays for economy, and the hours in airports and hotels were interminable. Once, I was coincidentally assigned the seat next to Sherman on a commercial flight to Vienna. She raised her eyebrows in disbelief upon seeing me, before closing a black ring binder and joking that she now had an excuse to watch “Quartet,” a film starring Maggie Smith, instead of reading her briefing book next to a journalist.

With hundreds of technical details and the possible military dimensions of Iran’s program to address, the original six-month time frame for a final deal was unrealistic, U.S. officials say now, given that Iran was unwilling until negotiations reached the final months to accept the curbs the international community was demanding. Progress was also partly slowed down by lingering misgivings among the other foreign ministers who suspected the U.S. and Iran of trying to cut a deal without them.

“Our partners forced us to double down” on inefficient large group sessions in which no real decisions could be made, says Nephew, who believes talks “didn’t really get serious” till the first deadline was extended on July 19, 2014. By then, U.S. partners were confident in the process and glad for Kerry and Zarif and their expert teams to hold direct talks to help break through logjams to save everyone else time.

Russian Foreign Minister Sergei Lavrov was helpful in breaking stalemates throughout negotiations by letting his Iranian counterpart Javad Zarif know that Russia stood firm with the other powers. At a Vienna photo opportunity when talks were stubbornly dragging on and Lavrov had other places to be, Zarif politely asked how he was that morning, while smiling for the cameras. The Russian made a sour face and in front of the assembled press replied, “Angry.” Above, Zarif and Lavrov in Moscow in January 2014, just days before the Joint Plan of Action was adopted. | Getty

Even so, Washington got help from sometimes unexpected quarters. Diplomats describe Russia’s nuclear negotiator, Sergei Ryabkov, as a creative problem solver who was a favorite of the six powers. The Ukraine crisis and sanctions on Russia were somehow kept separate from the Iran talks, where Russia stood firm with the other powers. Foreign Minister Sergei Lavrov, a smooth, multilingual veteran diplomat, was loath to waste his time, and on several occasions in the final months, Lavrov broke stalemates by telling Zarif that Russia was united with the other powers. At a Vienna photo opportunity when talks were stubbornly dragging on and Lavrov had other places to be, Zarif politely asked how he was that morning, while smiling for the cameras. The Russian made a sour face and in front of the assembled press replied, “Angry.”

China usually took a back seat in the talks but will play a key role in implementing the deal by modifying Iran’s heavy-water reactor. Germany’s Steinmeier used dry humor to lighten the mood and was a dead ringer for Ryabkov, creating confusion among journalists staking out the negotiators.

As the months dragged on, incremental progress was made against a backdrop of growing turmoil in the Middle East. The Syrian conflict raged on, with Iran propping up Bashar Assad while the U.S. demanded he go, all while the Islamic State terrorist group, an avowed enemy of both Iran and the U.S., was on the rise.

Medical mishaps delayed progress. Zarif suffered stress-induced back pains that forced him to conduct early negotiations in a wheelchair and landed him in the hospital upon his return to Tehran. Sherman broke her nose in Vienna and her finger on her way to a briefing for Congress, bursting into tears after she took the last question.

At a particularly frustrating negotiation in Geneva where Zarif was trying to backtrack in May of this year, Kerry got uncharacteristically angry, slamming his hand on the table and sending a pen flying. Frustrated and off-center, he suited up for a bike ride the next day to refocus. Distracted by the noise of a motorcycle in his security detail, he slammed into a curb before he even left the parking lot, breaking his femur in three places and requiring surgery. One of the first get-well messages Kerry received was from Zarif. The secretary remained on crutches, propping up his foot and doing daily physical therapy through the end of the negotiations two months later.

Iran’s atomic energy chief Salehi was hospitalized and missed key meetings following a colon procedure. Talks were deadlocked in the final round until Zarif flew home and brought his convalescing colleague back.

There were several times when negotiators now acknowledge the talks were on the verge of collapse. Two weeks before a November 2014 deadline, the Iranians dug in their heels with Kerry and other foreign ministers in Oman, trying to roll back earlier agreements. The talks were a disaster, and negotiators knew they needed yet another extension.

Another near breaking point was February 21 this year, when Sherman phoned Kerry in London warning him not to board his plane to Geneva; the Iranians were demanding a much greater enrichment capacity than the U.S. could ever agree to. “This was really stuck,” a senior official recalls. Kerry told Sherman to say he was “ready to go back to the U.S. and get on with his life.” Several hours later, she called back and said talks were back on track. Kerry flew in.

By the time talks moved to Lausanne, Switzerland, in March, the deadline for a framework agreement was looming. The Americans made clear it would be impossible to fend off new congressional sanctions on Iran if the two sides couldn’t agree on the outline of a final deal that month. The task was immense: to agree on the size of Iran’s enrichment program, time limits for research and development, inspections and verification and changes to Iran’s heavy-water reactor so that it couldn’t produce plutonium that could be another path to a weapon.

The details were mind-numbing and emotions ran high as Zarif and Salehi said they couldn’t be pushed farther than their leaders in Tehran would allow. In July 2014, a week before a previous deadline, Supreme Leader Khamenei had announced Iran needed 190,000 centrifuges for an industrial-sized atomic energy program—10 times what it currently had. That public red line had thrown off talks for months.

Holed up in the Beau Rivage Palace, a grand 19th century hotel overlooking Lake Geneva, with no room left for an extension, the Iranians continued to make what the Americans saw as unreasonable demands. Kerry got so frustrated that he arranged to visit Zarif one night in his hotel suite. “If you can’t do this deal, if you’re not serious, go back to Tehran and get some instructions,” Kerry told the Iranian, according to a senior State Department official.

After two nine-hour, all-nighter sessions in a row, the diplomats “cracked the DNA of the deal,” in the words of another senior negotiator. They agreed on April 2 that for 10 years, Iran would be allowed to use only 5,000 of its centrifuges to enrich uranium and would reduce its low-enriched uranium stockpile by 98 percent. The framework included a face-saving solution to convert Iran’s Arak heavy-water reactor and underground Fordo facility so Iran could say it had kept them open, but neither would produce fissile material.

The final round of talks moved back to Vienna and would drag on for 18 days (many of them all-nighters), starting in late June. More than 600 journalists from around the world and dozens of pro- and anti-deal activists and academics descended on the media tent and lobby of the Vienna Marriott, fueled by an endless supply of Mozart Kugeln chocolate marzipan balls and Manner hazelnut wafers provided by the Austrian government. Security was tight at the neoclassical luxury Palais Coburg Hotel, nicknamed the “Asparagus Palace” for its ornate columns, where the talks took place across from the Marriott. During negotiations, no one got past a metal detector and X-ray machine without an official badge, though the hotel somehow also managed to host wealthy Austrians celebrating special family gatherings, creating some odd juxtapositions in the lobby and banquet areas.

Diplomats and journalists incurred huge laundry bills and bought new clothes in desperation when the days turned to weeks, missing birthdays, anniversaries and another Fourth of July at home. U.S. negotiators spent rare free moments on FaceTime with their families. Kerry, powered by pasta Bolognese, his go-to meal during the months on the road, was hobbling on crutches and undergoing daily physical therapy. He started to slip out a back exit to avoid press when he needed fresh air. The 10-year-old son of my Vienna-based Bloomberg colleague was feeding ducks at a city park one day when Kerry, surrounded by an intimidating security retinue, arrived on a rare break to do the same.

If you can’t do this deal, if you’re not serious, go back to Tehran and get some instructions.”

It was not until that final stretch in Vienna that American and Iranian delegates, who spent countless hours together over the previous two years, actually shared a meal. It was an impromptu invitation from Zarif on July 4th, the second Independence Day that many Americans had spent in Vienna rather than at a barbeque. When Kerry hosted his own Independence Day party on the Coburg terrace a few hours later for his entourage and the small press corps that travels on his plane, the negotiators were still talking about how much better the Persian banquet was than what they ate in the U.S. delegation’s dining room.

There were also far less pleasant encounters, evenings of high drama as both sides dug in on final offers, sometimes disintegrating into shouting matches. On July 5, Kerry and Moniz were arguing with Zarif and Salehi, who were backtracking on how many years the restrictions on Iran should last. The debate got so heated that a Kerry aide entered the room to tell the men they could be overheard by random guests. The next morning, Steinmeier quipped to Kerry that the talks must have been productive. “The whole hotel could hear you,” the German said, his eyes twinkling.

The joke, though, hid a darker truth: The foreign ministers of the P5+1 nations were losing their patience. Most of the nuclear elements had been agreed upon three months earlier, and the offer to lift sanctions only after nuclear curbs were verified was non-negotiable. The next night, the ministers presented Iran with a final proposal, and the EU’s Federiga Mogherini said if Zarif was trying to rewrite the terms set in Lausanne, they might as well all go home. Cornered by the world powers, Zarif lashed out angrily, “Never threaten an Iranian!”

In an effort to lighten the tense moment, Russian Foreign Minister Sergei Lavrov chimed in dryly, “Or a Russian.” It allowed Zarif to save face, but on the substance, the Russians were sticking with the other powers.

The talks had ground past the June 30 deadline, and both sides knew this was their last chance to negotiate their best deal or walk away. At a P5+1 foreign ministers’ dinner on July 12 at the swanky Sofitel rooftop with its stunning skyscraper view of Vienna’s imperial architecture, Kerry urged his impatient partners who were threatening to go home to stick together and see the process to the end.

The last two days were spent arguing with Iran over how to “snap back” U.N. sanctions if Iran cheated on the deal, and how to maintain an arms and missiles embargo which, under the original U.N. resolution, was meant to be lifted once Iran addressed concerns over its nuclear program. On the final evening, Kerry, Zarif, Lavrov and Mogherini stayed up till nearly 3 a.m. hashing out the final language of the U.N. resolution. Aides drafted the technical documents by dawn.

Later that morning on July 14, after a few hours of sleep and showers, the ministers met at the U.N. offices in Vienna. With only a handful of top aides as witnesses, they spoke in alphabetical order by country, trying to express in a few solemn words the significance of a long-awaited day many had thought would never come.

France’s Fabius grandly noted that the deal was finalized on Bastille Day and said he hoped the accord would have as distinguished a history as the French Republic. Zarif was righteous, saying the agreement marked the end of the unjust isolation of his country. Kerry spoke last, noting he had gone to war in Vietnam as a young man, and was forever changed. His voice broke, and he paused to collect himself. While force was sometimes necessary, he said, diplomatic means must always be exhausted first. His voice quivered, and when he finished, several diplomats, including Iranians, were seen wiping their eyes.

Kerry put down his crutches and sat backstage to watch Obama’s live remarks from the Rose Garden on an iPad. When it was over, in a distant echo of the moment they first met in a U.N. office in New York two years earlier, Zarif sought out Kerry to pat him on the back, shake his hand and tell him to keep in touch.