Donald Trump’s undermining of the Iran nuclear deal only shrinks US options for dealing with North Korea. The US president’s decertification of Tehran’s compliance will be well noted in Pyongyang, giving North Korean leader Kim Jong Un a credible excuse for refusing to negotiate with Washington.

The US-North Korea situation is becoming more fraught as both sides attempt to pile on pressure, pushing prospects for talks further away.

Just two months ago, I argued that Americans needed to put North Korea’s missile tests in perspective. (“Yes, they’re worrying. But the US mainland is not in imminent danger.”) Now I’m slightly less sanguine: either side could make a catastrophic miscalculation while tensions persist. Even before Trump’s decision on Iran, the prospects for negotiations were diminishing.

For one, things got personal. Following an incendiary Sept 19 speech at the UN General Assembly in which Trump called Kim Jong Un “Rocket Man” and threatened to “totally destroy” North Korea, Kim wrote a personal letter, carried by Pyongyang’s main newspaper, calling Trump a “dotard,” among other things.

Insults and mudslinging have become part of the currency in US domestic politics, but what works on the campaign trail won’t work with North Korea. There, the dignity and image of the leader is near-sacred and name-calling will be counterproductive. Elite politicking in Pyongyang is in no small part about competing to show loyalty to the supreme leader. Debate does take place at very senior levels, but only before Kim announces a position — never in contradiction to it. Any North Korean voices promoting a softer line will have been further hushed by the personal offense Kim has taken and by his forceful rhetorical pushback.

Second, the UN Security Council tightened sanctions against Pyongyang in August and September. These have banned all North Korea’s major exports, including textiles, seafood and coal as well as joint ventures with foreign companies and new contracts hiring North Koreans as labourers abroad. China’s agreement to these measures was key and some degree of enforcement seems to be taking place.

This reinforces Pyongyang’s bunker mentality. The zero-sum game it sees with Washington is now compounded by China’s “betrayal” in supporting these sanctions. North Korea feels it is in a life-or-death struggle and cannot be seen to flinch at this, its most difficult strategic moment in the 21st century. Given the extreme level of state control over its citizens, North Korea is also well positioned to endure suffering and tolerate a severe economic contraction.

This brings us to Iran, where the political system is partially democratic and where sanctions did indeed contribute to voices of compromise in Tehran’s government. This led to negotiations and, finally, in 2015 the Joint Comprehensive Plan of Action (JCPOA), usually referred to as the Iran nuclear deal.

The agreement is not perfect. After many years of talks, however, European and US negotiators thought the deal was the best they could get. The deal does make it extremely difficult for Iran to develop nuclear weapons. Iran’s uranium stockpiles have been reduced by over 95 per cent, its centrifuges by over 60 per cent and its ability to enrich uranium has been capped far below the threshold for nuclear weapons. Inspections verify this at all points in the supply and production chains.

The agreement’s limitations include having expiration dates on these restrictions. It also does not include curbs on Tehran’s missile programs. But Trump’s refusal to re-certify Iran’s compliance last week seems largely because of Iran’s other moves in the Middle East, including support for Bashar al-Assad in Syria and Hezbollah in Lebanon.

Trump’s Oct 13 speech has not killed the deal – at least not yet – but it does kick the ball over to Congress, which now has to determine whether to pull out or remain. It’s not clear what Congress will do but the deal will be in jeopardy if Congress decides to resurrect pre-deal sanctions or introduce new ones.

Crucially, International Atomic Energy Agency inspectors and all the other parties to the Iran agreement, including the European Union, Germany and UN Security Council members China, France, Russia and the United Kingdom say Iran is in compliance and that the deal should remain in place. In various statements they have all said the deal should continue to be adhered to.

Trump laid out a broader policy in which he wants to pressure US allies into redoing the deal, while also trying to contain Iran’s other activities in the region more actively. But blowing up the deal would only further isolate Washington on the world stage.

This is important in terms of taking the high ground in the tensions with North Korea. Many countries in the international community, especially China, have been trying to coax North Korea back to negotiations, but they have been consistently rebuffed. Pyongyang officials argue that their country has a right to have nuclear weapons and that they are a necessity as deterrence against their old enemy.

On top of that, the North Korean authorities now can say: “See? Even if we come back to talks and make a deal with the United States, how can we trust them? Why would we ever give up our nuclear weapons for an agreement with this country?” To be fair, the regime already doesn’t trust the US for its own reasons, but now it can justify it to the international community and make it harder for America’s allies to credibly argue against it.

Moreover, will China and Russia sign on to further UN Security Council resolutions against North Korea when the United States has shown itself to be so reticent to abide by complicated, negotiated solutions? These two countries may even lose patience with enforcing UN sanctions if they perceive the Trump administration to be only focused on pressure as a punitive measure rather than an attempt to find constructive solutions.

A negotiated solution to the North Korea crisis now seems well beyond the horizon. Trump’s jeopardising of the Iran deal nudges it even further away. Until it comes into view, we all need to hope that neither side makes a mistake as they try to project toughness during this fraught period.

Andray Abrahamianis a WSD-Handa Fellow at Pacific Forum CSIS and Adjunct Fellow at the Griffith Asia Institute.