President Trump gestures after announcing his intent to withdraw from the Iran nuclear agreement.Jonathan Ernst / Reuters

For decades, since the Iranian Revolution, the United States has engaged in a quasi-war with Tehran. Washington backed Saddam Hussein in the Iran-Iraq War, described Iran as being part of an “axis of evil” alongside Iraq and North Korea, launched the Stuxnet cyberattack on Iranian nuclear facilities in 2009, and provided weapons for Saudi Arabia to fight a proxy war against Iran in Yemen. Today, the United States and Iran still lack formal diplomatic relations. President Donald Trump described Iran as “the world’s leading state sponsor of terrorism,” with a “sinister vision of the future.” Meanwhile, Iranian propaganda pushes a narrative of resistance against the United States—the “great Satan”—as well as Israel.

It’s striking, then, that since 9/11, major U.S. foreign-policy gambits in the Middle East have consistently aided Iranian interests. America is not so much Iran’s frenemy as its fremesis: a supposedly mortal adversary that unintentionally gives critical support. By scrapping the Iran nuclear deal, Trump is following an established U.S. playbook of helping Tehran.

America’s puzzling tendency to further Iranian interests began in 2001 with the removal of the Taliban from power in Afghanistan. Of course, Washington’s goal was not to help Iran, but instead to fight al-Qaeda and its state sponsors. Nevertheless, the effect of the intervention was to topple one of Iran’s major opponents. At the time, Iran backed rebel groups fighting the Taliban, and almost launched a full-scale war against the Islamist group in 1998 following the killing of Iranian diplomats in Afghanistan. Today, as Washington looks to exit Afghanistan, Tehran has performed a diplomatic pirouette by providing backing to the Taliban, in order to speed up the American departure and maximize Iranian influence.

America’s second gift to Iranian security was the 2003 invasion of Iraq. Saddam was Iran’s mortal adversary. Iran fought a brutal war against Iraq in the 1980s, suffered hundreds of thousands of casualties, and endured chemical-weapons attacks and missile strikes on Iranian cities. After 2003, with Saddam deposed, Iraq was transformed into a virtual client state of Iran. Tehran is now the indispensable nation in Iraqi politics, deciding government policy and settling disputes. When the Iraqi Kurds pursued an independence referendum in 2017 that threatened full-scale conflict with Baghdad, it was Iran, not the United States, that negotiated an end to the standoff.

If Iran had tried to overthrow Saddam Hussein directly through an invasion, it would have provoked a balancing response from Arab states and the West. Instead, American planes descended from the sky like blessed angels to hammer Saddam’s regime with “shock and awe,” while Tehran reaped the rewards.

Still, the United States wasn’t done helping Iran. In 2014, after ISIS swept into northern Iraq, the United States constructed a coalition of over 80 states to battle the Sunni extremists. Who benefited? Iran, of course. As ISIS’s power waned in Syria and Iraq, Iran entrenched its strategic position. For example, Iran trained Shia militias to fight ISIS, known as Popular Mobilization Units, creating a powerful military asset.

In summary, the United States has a consistent tendency to aid its supposed nemesis. For two decades, the United States poured treasure into the Middle East and Iran cashed the checks. Washington removed enemies on Iran’s eastern and then western borders. Tehran’s forces can now cross a “land bridge” from Tehran to Beirut, which Washington helped to build.

The explanation for American generosity is that Washington pursued a short-term strategy to remove bad guys and ignored the broader political consequences. Time and again, battlefield success created a power vacuum—into which Iran eagerly stepped.

The exception, where Washington successfully checked Iranian ambitions, was not through the use of force but through diplomacy: the Iran nuclear deal. A combination of tough sanctions and hard-nosed multilateral negotiations led Iran to shut down all pathways to a nuclear bomb for a decade or more, place two-thirds of its centrifuges in storage, give up around 95 percent of its uranium stockpile, and accept the most intrusive inspections regime in modern history.

By ripping up the nuclear deal, Trump has returned to an old and failed American strategy: Disregard the political ripple effects, apparently fail to think multiple moves ahead, and potentially further Iranian interests. Britain’s Foreign Secretary Boris Johnson wrote in The New York Times, “Only Iran would gain from abandoning the restrictions on its nuclear program.”

The White House has achieved the seemingly impossible: making Iran look like an upholder of agreements and a defender of international law. A regime that routinely flouts international norms, lied about its nuclear program for years, provided weapons to Iraqi insurgents, backs Hezbollah and Hamas, and continues to develop a long-range missile program, can nevertheless seize the moral high ground. For all its sins, Iran has apparently stuck by the terms of the nuclear deal. It is America that tore the agreement to pieces.

The act of diplomatic sabotage will drive a wedge between the United States and its European allies, crippling the prospects for a united front against Iran. The European Union may refuse to comply with new American sanctions against Iran, causing a crisis in Atlantic relations.

Unshackled from the deal, Iran is now free to decide whether to hit the accelerator on its nuclear program, or whether to allow inspections to continue. In a recent public presentation, Israeli Prime Minister Benjamin Netanyahu described Iran’s secret nuclear activities from 1999 to 2003. Destroying the deal will only facilitate a new covert Iranian program.

Although Iran will gain strategically by dividing the United States and the EU, it may lose in the longer run if Trump’s actions embolden hardliners in Tehran. Iranian president Hassan Rouhani’s bid to break the country’s isolation could be viewed as a fool’s errand, tarnishing the whole idea of engagement. But if Iran ends up boosting aid to the Taliban, strengthening its missile program, or kicking out nuclear inspectors, the outcome would also be a defeat for the United States.

The tragedy is that America’s European allies are eager to fix problems with the nuclear deal, including lengthening the time frame for restrictions on Iran’s nuclear program and limiting Tehran’s missile program.

Iran must wonder why the “great Satan” keeps delivering manna from heaven.