IT WAS historic: everyone can agree on that. But whereas some say the deal done in Vienna this week between Iran and six world powers plus the European Union was a breakthrough that keeps nuclear proliferation at bay and begins to mend a 36-year feud with America, others are convinced it was, as Israel’s prime minister, Binyamin Netanyahu, says, a “stunning historic mistake” that sets up Iran as a nuclear power and finances its aggression abroad.

Which of those is closer to the truth depends on two things: the quality of the agreement and its effect on Iran’s behaviour.

With Iran, backers as well as critics—especially in America’s Congress, which now has 60 days to scrutinise the deal—both tend to lapse into magical thinking. The critics argue that, if only the world tried hard enough, Iran would give up the guts of its nuclear programme. But the regime sees mastery of the nuclear-fuel cycle as both a badge of national power and insurance against American military attack, so the critics risk holding out for a bargain that never comes.

Backers play down the Iranian regime’s antagonism towards America and Israel, its determination to exert influence abroad and its willingness to use violence. They place too much reliance on a transformation of the Iranian regime that may never come about.

With or without an agreement, the world is stuck with an Iran that continues to run a big nuclear programme and remains slippery and dangerous. The real test of the deal is whether it is better than the alternatives. It is.

A nuclear balance-sheet
The critics are right that the agreement legitimises Iran as a threshold nuclear state. If it keeps its word and avoids further restrictions on its programme, Iran will have the know-how and eventually the capacity to arm itself. Yet it will also face greater restraints than it does today.

Iran’s ability to enrich uranium, the fuel for a bomb, and to develop a weapon will be severely constrained for somewhere between ten and 15 years. After that, it will be subject to the full force of the international treaty against proliferation. The government has agreed to intrusive monitoring of all its nuclear facilities and to inspections on request of its military sites, under a system of “managed access”.

Sanctions, which are to be lifted as a result of the agreement, can be reimposed if Iran violates it.

For those who oppose this deal, the alternatives are to wait for a better one, or to go to war.

Some argue that since sanctions won concessions, more sanctions will win more concessions.

Yet if America walked away now, China, Russia and the EU would lose faith in the process and sanctions would crumble instead. Moreover, to think that Iran would surrender the heart of its programme is a reckless gamble. Threatened, it would be more likely to dig in its heels. Iran’s nuclear expertise has grown since 2000, and would expand further still in the years before talks were possible once again.

Delay could thus end up making an ambitious agreement even harder.

Some critics may believe that attacking Iran is the only option. But war is a poor form of arms-control. Even if America had the stomach for a months-long campaign, and even if it could take out all of Iran’s many nuclear sites, bombing cannot destroy nuclear know-how. Instead the programme would go underground, beyond the reach of monitors. An attack would thus be a route to a nuclear-armed Iran. Should Iran dash for the bomb, war might make sense as a last resort, but that option will not disappear just because of this week’s agreement.

Get real
But the deal brings dangers that its backers are slow to acknowledge. Although the economy is hard-pressed, Iran devotes precious resources to Iraq and Syria; it sponsors Hizbullah, the Lebanese militia-cum-party; and whips up emotions in Bahrain and Yemen. Relieved of sanctions, a richer Iran would surely spend money extending what is mostly a malign influence.

Iranian violence abroad may well worsen, as a sop to hardline opponents of the deal in Tehran and as a gesture to show the world that Iran has not gone soft. The perception that the United States is a declining power, which alarms Israel and America’s allies in the Gulf, may feed Iranian ambitions.

That is not the whole story, however. The nuclear deal binds Barack Obama, America’s president, into the Middle East. This is his foreign-policy legacy and he is its enforcer-in-chief, just as his successors will be. Iran’s “empire” is in turmoil—roiled by jihadists (including Islamic State), war with Saudi Arabia in Yemen, and a failing regime in Syria. Extra money will help Iran’s efforts, but as America discovered in Iraq, dominance is not determined by resources. If the United States buttresses its oversight of the agreement with sustained regional diplomacy, needed anyway after the Arab spring, then it can help contain Iran.

Although the deal will make Iran more powerful, it will also lead the country to become more open. As in China, the Iranian theocracy rules over a population that long ago lost its revolutionary zeal.

The regime agreed to constrain its nuclear programme because, again as in China, it calculated that it is more likely to survive if Iranians feel that they have a shot at prosperity. Unlike North Korea’s Kim dynasty, which cheated on its nuclear pact, Iran’s supreme leader, Ayatollah Ali Khamenei, decided that being a pariah was worse for his regime than rejoining the world.

That choice only makes sense if Iran can now attract trade and investment. The more Iran trades with the rest of the world, the more susceptible it will grow to international pressure. As the country becomes enmeshed in the global economy, interest groups will emerge within Iran’s complex, factional politics who will argue that the country’s future is better served by decent relations with foreigners than by bad ones. The more Iranians benefit from ties with the outside world, the stronger those moderating voices will become.

A country of Iran’s size and sophistication will get a bomb if it really wants one. Nothing can change that. But this pact offers the chance of holding Iran back and shifting its course. The world should embrace it, cautiously.