Donald Trump did not create the raging sore that North Korea has become, but he does done little to soothe it. On the contrary, his instinct, as with so many other things, has been to prod and scratch. If you think this sounds dangerous, you are not alone. The whole world is nervous.

Let’s be clear, though, this is not pure fecklessness. Trump is in part a victim of timing. If previous US presidents, going back to Bill Clinton, were able one way or another to sweep the North Korea conundrum under the rug it was because the threat it posed remained largely theoretical. The regime’s quest for nuclear mastery was still in the slide-rule stage.

The detonation of what may or may not have been a hydrogen bomb last Sunday – rattling pantries as far away as northeastern China – and the lobbing of a missile over Japanese territory a few days earlier were reminders that that latitude is now largely gone. If Pyongyang cannot yet land a nuclear-tipped missile on San Francisco, it appears to be approaching that point. The theoretical may very quickly become a terrifying doable.

Barack Obama warned then President-elect Trump back in January that this would be his most vexing foreign policy test, an assessment that probably didn’t require much prescience. That Trump is meeting it head-on is arguably to his credit.

So far, so good. But it’s one thing to acknowledge the dragon in the room and another to find a way to slay it without collateral calamity. Trump and his crew have yet to convince that they have the necessary talent, let alone diplomatic finesse, to bring this situation to an acceptable conclusion – ie without hundreds of thousands dying.

Some consistency of message would help. While Kim Jong-un has been coolly single-minded, undistracted by the West’s assorted remonstrations against him, the United States has given us the opposite. Trump is the worst culprit here. What was that he said about Kim in May? Oh yes, that his holding on to power at such a young age means he must be a “pretty smart cookie”.

If the South Koreans were puzzled then they were bamboozled at the weekend when Trump chose the most dangerous moment in the crisis so far to cast aspersions on them, of all people. On Twitter, he faulted President Moon Jae-in, South Korea’s new President, for what he called “talk of appeasement”. This as the White House was publicly musing about pulling out of the US-South Korea free trade deal negotiated a decade ago. When you’re in a jam, undermining your best friend who is in it with you does not seem the smartest tactic.

By Tuesday morning, we had a more supportive tone from Pennsylvania Avenue, with Trump announcing plans, via Twitter, “allowing Japan & South Korea to buy a substantially increased amount of highly sophisticated military equipment from the United States”. Seoul could relax. Trump loved them again. The South Korea-US-Japan alliance had been mended again even if pointing a lot of new conventional weaponry at Pyongyang is unlikely to change things much.

Trump, May and other world leaders condemn North Korea's nuclear test

Along the way, Trump has frayed relations with two other countries key to getting this resolved, China and Russia. “North Korea is a rogue nation which has become a great threat and embarrassment to China, which is trying to help but with little success,” he noted in one tweet. He has meanwhile floated the notion of an American embargo against any country doing trade with North Korea. That would clearly involve China, which made this an empty, even absurd, threat. The US ending all commerce with China would plunge the world into recession and will never happen. So why say it?

That the Moscow-Washington axis is tense right now barely needs explaining. But it was while in China on Tuesday that Vladimir Putin offered a sharp rebuke to Trump for his handling of the crisis, warning that, “whipping up military hysteria makes absolutely no sense in this situation”. Putin was referring to Trump’s pledge to rain “fire and fury” on North Korea if it continues on its current course. He also voiced opposition to new sanctions that the US is now seeking, perhaps not surprisingly given that it is only a few weeks since Trump signed a new law imposing sanctions on three countries all at once – North Korea, Iran and also Russia.

If massive loss of life is to be avoided, even whole cities or countries destroyed, then this confrontation will have to be resolved with legal treaties and diplomatic salves, not the firing of missiles and interceptors. Maybe some members of the Trump administration understand this. “We are not looking to the total annihilation of a country, namely North Korea,” Secretary of State James Mattis said on Sunday. (Although, how reassuring that was, we are not quite sure.)

Trump is right not to understate the problem that is Pyongyang. But his urgent priority now is to decide what he can bring to the table to resolve it, up to and including accepting the North as a new nuclear power and – more trickily – accepting a reduction of its military activity and operations in the south of the peninsula.