On 8 May, President Trump took a giant American hammer to the Iranian nuclear accord. He announced that the US would withdraw from the 2015 Joint Comprehensive Plan of Action and re-impose sanctions against Tehran.

In a single masterstroke, the President upended not only the centrepiece of his predecessor’s legacy but also the key plank in Europe’s Middle East trade and security policy.

Little wonder that Federica Mogherini, the EU’s top foreign policy chief, was so full of contempt. She likened the US withdrawal to “systematically destroying and dismantling everything that is already in place” which she dubbed “the mood of our times”.

But on this occasion, Trump’s decision was entirely reasonable. The JCPOA is a deeply flawed arms control agreement based on shoddy diplomacy. Designed permanently to prevent an Iranian bomb, it allows Iran to develop advanced centrifuges (IR-8s) and carry out research and development.

In 2017, David Albright, a former weapons inspector, and Olli Heinonen, a former deputy director general of the IAEA, said Iran could have already “stockpiled many advanced centrifuge components” and “associated raw materials”. They added that it was necessary to ascertain the centrifuge parts that Iran had made or procured. But such a task is made nearly impossible given the agreement’s second flaw, that Iran does not permit any-time, any-place inspections at its military sites.

This is of vital importance because it is believed that these bases were previously used for weapons testing, most especially at Parchin, and because Iran refused to provide a full account of its past nuclear weapons research. By tolerating Iran’s refusal to open up its military sites, the IAEA’s claim that the regime is complying with the deal is nonsensical.

The third flaw is that the deal is silent on Iran’s development of ballistic missiles. These are an essential component in the country’s nuclear infrastructure and the failure to tackle them is a glaring omission. Finally, there are the sunset clauses which, once lifted, provide Tehran with an internationally recognised means of achieving nuclear weapons capability.

When this deal was negotiated, President Obama hoped that it would pave the way to a genuine rapprochement with the regime, moderating its behaviour in the Middle East. Such hopes were always in vain.

Iran has instead plundered and butchered its way through Syria and Yemen, sowing mayhem everywhere with the tens of billions of dollars released under the deal. How the ayatollahs must be laughing at western naivety.

Right now, the EU has indicated that it will sustain the JCPOA and defy US pressure. But if the accord is blown up, there needs to be a Plan B, and there lies the challenge. It is not clear whether Trump has one, nor is the President noted for his sense of strategy. Nonetheless, America and other western countries have leverage and should use it sensibly.

A new deal could be constructed which avoids the obvious flaws of its predecessor. It could ensure that there are no sunset clauses so that the ayatollah regime is permanently deprived of nuclear capability. It could roll back its ballistic missile programme while permanently shutting Iran’s nuclear infrastructure, including its advanced centrifuges.

It could also insist on a proper verification process so that no suspected sites are off-limits to inspectors. Finally, full sanctions relief could be made dependent on a full Iranian withdrawal from Syria.

If Tehran is adamant that it will not comply, there needs to be a plan for even further economic pressure or the use of military action against the country’s nuclear sites. This is the equivalent of having ‘all options on the table’, something that was so clearly lacking in the approach of the previous US administration.

Thus, starting to unravel the nuclear deal is only the first part of what is needed. Only time will tell if the American hammer is designed to rebuild or merely destroy Obama’s flawed legacy.