Phil Noble / Reuters Saudi Arabia's Prince Mohammed bin Nawaf bin Abdulaziz in London in 2011

As Middle Eastern nations attempted to elbow one another aside in their efforts to offer encouraging statements about the recently concluded nuclear talks between Iran and six world powers on Sunday, Saudi Arabia took its time. More than a day later the Cabinet offered its own pallid take: “If there is goodwill, then this agreement could represent a preliminary step toward a comprehensive solution to the Iranian nuclear program.” Behind the gritted-teeth delivery there lurked an almost palpable sense of frustration, betrayal and impotence as Saudi Arabia watched its foremost foe gain ground in a 34-year competition for influence in the region.

As discussions leading up to the historic agreement in Geneva unfurled over the past several months, Saudi did its utmost to express its discontent, lobbying behind closed doors for greater restrictions on Iran’s nuclear program and rejecting at the last minute a long-sought seat on the U.N. Security Council. Saudi officials even threatened to get their own nuclear weapons; just before the talks concluded the Saudi ambassador to the U.K., Prince Mohammed bin Nawaf bin Abdulaziz, told the Times of London: “We are not going to sit idly by and receive a threat there and not think seriously how we can best defend our country and our region.”

(MORE: Iranians Celebrate Nuclear Deal)

“It’s as if Saudi Arabia and Iran suddenly traded places,” marvels Riyadh- and Istanbul-based Saudi foreign-affairs commentator Abdullah al-Shamri. “Now [U.S. President] Obama and [Iranian President] Rouhani are talking on the phone while their Foreign Ministers shake hands, and it’s Saudi Arabia that is throwing the temper tantrums at the U.N., shouting about nuclear weapons and trying to show the world that they are angry.”

Saudi Arabia’s frustration with the Iranian deal has little to do with nuclear weapons, and everything to do with insecurity, says F. Gregory Gause III, a professor of Middle Eastern politics at the University of Vermont. “It comes from a profound and exaggerated fear that a nuclear deal with Iran is a prelude to an American-Iranian geopolitical agreement that in essence leaves Iran as the dominant power in Lebanon, Syria and Iraq.” The U.S., of course, is unlikely to turn the keys to the region over to Iran anytime soon, but the Saudis are not entirely wrong in thinking the Obama Administration wants to disengage from the region, says Gause. The U.S. “backed off in Syria, it’s not taking an active role in Iraq, and it does want better relations with Iran.” From this, he says, the Saudis have pieced together a convincing narrative of abandonment that is causing them to lash out in unpredictable ways.

As the first round of nuclear talks got under way on Nov. 7 in Geneva, select leaks to the Western media suggested that Saudi Arabia was planning to buy nuclear weapons from Pakistan. A month before, former Israeli military intelligence chief Amos Yadlin told a conference in Sweden that if Iran got a bomb, “the Saudis will not wait one month. They already paid for the bomb, they will go to Pakistan and bring what they need to bring.”

(MORE: Not Everyone’s Happy: Hardliners in Iran Criticize Geneva Nuclear Deal)

There may be truth to Yadlin’s comments. Saudi Arabia has backed and at times helped fund Pakistan’s nuclear program, according to proliferation experts. (The program became public in 1998.) That doesn’t mean that acquiring a nuclear bomb is as easy as shipping it across the Arabian Sea. Saudi, as a signatory to the Nuclear Non-Proliferation Treaty, would risk global reproach, possible sanctions and the launch of a regional arms race if it had its own bomb. A more likely scenario, says Gary Samore, Obama’s former arms-control adviser and director for research at the Belfer Center for Science and International Affairs at Harvard University, would be some sort of pact that could see Pakistani nuclear weapons moved to Saudi Arabia. “Even if U.S. diplomacy fails and Iran gets nuclear weapons, Pakistan isn’t just going to hand over nuclear weapons; it’s more likely that Pakistan would station forces in Saudi, and those forces will have the ability to deploy nuclear weapons from Saudi soil” — much like American troops are able to do in Europe, without contravening those country’s nonproliferation treaties.

Still, such a pact would have significant drawbacks, points out Gause. Pakistan may not be willing to attack its neighbor Iran for fear of repercussions, and it would be a death knell for the U.S.-Saudi friendship. “In terms of putting at risk relations with the United States, a Pakistani nuclear pact would be the most provocative Saudi foreign policy decision since the 1973 oil embargo,” says Gause. That might serve Saudi pique at being sidelined by its old ally America as that ally pursues a lasting deal with Iran, but it would ultimately be self-defeating. Better for Saudi in the long run would be a deal that brings Iran closer to the U.S., and further from a bomb.

MORE: Conservative Saudi Arabia Is Becoming a Hotbed for Amphetamines