The two sides will miss a Monday deadline, but Washington and Tehran have invested too much to walk away from the table.

By Elias GrollElias Groll is a staff writer at Foreign Policy, covering cybersecurity, privacy, and intelligence. , John HudsonJohn Hudson is a senior reporter at Foreign Policy covering diplomacy and national security.

After dozens of hours of closed-door talks, dramatic last-minute meetings between top U.S. and Iranian leaders, and a series of heated phone calls to anxious American allies in the Persian Gulf, nuclear negotiators in Vienna will miss a Monday deadline for a permanent deal.

Instead, the two sides have agreed to an extension of the nuclear talks until June with the hopes of agreeing on a framework outlining the substance of a final agreement by March. In the new interim agreement, Iran will reportedly gain access to $700 million of its frozen funds per month while continuing to halt enrichment of uranium to 20 percent.

"In these last days in Vienna, we have made real and substantial progress," said Secretary of State John Kerry in a press conference on Monday. "That is why we are jointly … extending these talks for seven months with the very specific goal of finishing the political agreement within four months."

While applauding Iran’s "good-faith" efforts at the negotiating table, Kerry said diplomats must begin working immediately to close the remaining gaps, noting that a meeting has already been scheduled for December.

The failure to reach a final agreement seemed likely Sunday night, when talks adjourned just 24 hours before the Monday night deadline.

Kerry had a long day of meetings there Sunday, shuttling from appointments with his Iranian counterpart, Mohammad Javad Zarif, and his partners in the so-called P5+1. But the scramble to secure a deal that would ease sanctions on Iran in exchange for Tehran freezing or rolling back its nuclear program appeared to be out of reach going into the last day of talks. A report in the Iranian media, from the Iranian Students’ News Agency, quoted an unidentified Iranian official involved in the talks saying that it "would be impossible" to reach a deal by the deadline.

Both sides view securing a deal as a possible landmark achievement and have each invested so much politically that the talks are likely to continue despite yawning divisions over the number of centrifuges Iran will be able to maintain and the timing of international sanctions relief for Iran. For Iranian President Hassan Rouhani, an agreement would provide his economy much-needed relief from Western pressure and prove his bona fides as a reformer hoping to pursue more open relations with the West. For President Barack Obama, whose approval ratings have slid amid a series of international crises, a deal would allow him to argue that he fundamentally altered America’s relationship with a longtime U.S. adversary and ended a major threat to the region’s security through peaceful means, not war.

Mindful of the stakes, Obama, in an interview with ABC this weekend, appeared open to the possibility of an extension to keep alive a top foreign-policy priority. Asked by George Stephanopoulos whether he was "willing to extend if there’s no deal by Monday," Obama replied that "I think that what we’re going to do is take a look at what emerges over the course of the weekend."

Although the outcome of the negotiations remains uncertain, Rouhani and Obama have an incentive to extend the talks rather than calling them off entirely given how much political criticism each has weathered to even get the talks to their current level. Rouhani has faced skepticism from some of his country’s religious conservatives, while some lawmakers from both parties say Obama is risking the security of Israel and other key American allies in the region.

"There’s no question that not getting a deal would be devastating for Rouhani, but he could also spin a collapse as a great victory for the rights of Iran, which could improve his ties with the hardliners," said Joe Cirincione, president of Ploughshares Fund, a non-proliferation group. "I think for both sides, it’s the closeness of the opportunity that bothers them. They’re so close to solving this problem and opening the door to other areas of cooperation in the region. That’s what keeps them at the table."

Cirincione, who is frequently briefed by the administration on the status of the deal, spoke on the sidelines of the Halifax International Security Forum, a gathering of foreign-policy experts, diplomats, military officials, and journalists. "The question is, what kind of extension is it?" he said. "Is it just a pure extension of the talks or is it another word that’s been bandied about: A framework agreement with a two-month extension to complete the details? If that’s what they come away with, that’s huge."

Still, analysts in Vienna said a number of key questions remain unanswered. "There are still gaps on some of the major issues, particularly the size of Iran’s uranium enrichment program and the sequence of sanctions relief," Kelsey Davenport, director for nonproliferation policy at the Arms Control Association, told Foreign Policy. "Both Iran and the United States will need to be flexible and willing to make concessions to overcome the remaining hurdles." At the moment, American diplomats are refusing to provide a date by which sanctions will be lifted and inspectors can ensure Iran is complying with the deal.

"I think Iran would love to see the sanctions end immediately, and then to still have some avenues that might not be completely closed, and we can’t do that," Obama told ABC.

Among the other points of disagreement is how long it will take for Iran to be allowed to freely develop a civilian nuclear infrastructure and how much freedom inspectors will have inside Iran to carry out their work.

On Sunday, Obama continued to talk about the negotiations in possibly world-historic terms.

"What a deal would do is take a big piece of business off the table and perhaps begin a long process in which the relationship not just between Iran and us but the relationship between Iran and the world, and the region begins to change," Obama told ABC. "You know, Iran’s not like North Korea, a country that’s just completely isolated and completely dysfunctional. So they have the opportunity, I think, to really thrive. I suspect President Rouhani would like to seize that opportunity, but in the end he’s going to have to deal with his politics at home, and he’s not the ultimate decider inside of Iran; the Supreme Leader is."

Indeed, Obama shares that obstacle with Rouhani and has his own hardliners at home with whom he must contend. There is a high degree of skepticism in Congress toward signing a deal with Tehran, and that will only increase if the talks extend beyond December when Republicans take over the Senate and increase their majority in the House of Representatives.

Some Democrats and Republicans have vowed to slap new sanctions on Iran if the delicate nuclear talks are extended — a move that could cause Tehran to walk away from the table and prompt a veto from the White House. And given the broad bipartisan skepticism of the talks, it’s possible that hawks in Congress could round up enough votes to override a presidential veto, a move that requires two-thirds votes of votes in both chambers.