This undated photograph released Sunday shows North Korean leader Kim Jong Un, second from right, examining a device at an undisclosed location. (Korean Central News Agency via KNS /Agence France-Presse via Getty Images)

EVEN ALLOWING for its usual fiery exaggerations and accompanying uncertainty about its technical prowess, North Korea is making quick and alarming progress as a nuclear and missile power. The underground test Sunday of a nuclear device — Pyongyang claimed it was a hydrogen bomb — produced by far the largest yield of six nuclear explosions since 2006. In the face of this growing challenge, the response from the rest of the world, led by the United States and China, is a shambling mess.

There is no military solution to this crisis. Despite President Trump’s bluster a few weeks ago about “fire, fury and frankly power the likes of which this world has never seen before,” a war would engulf Seoul, only 35 miles from the inter-Korean border. Nothing is wrong with displays of strength designed to deter the North Korean leader, Kim Jong Un, but ultimately the danger he poses cannot be resolved by U.S. preemptive action without huge costs for both Koreas.

If the Trump administration is to accept this reality, China and other states must embrace more fully the need for sanctions and other measures — including cyber and information operations — to vastly turn up the pressure on North Korea. The latest round of U.N. sanctions will be effective only if China aggressively implements them, unlike the halfhearted approach of the past. And more should be done to weaken the regime’s hold over its population, including steps to push more communications across North Korea’s borders — and allow more refugees out.

Ultimately, despite the long record of North Korea breaking deals, negotiations could be the path to a resolution. But the usefulness of talks right now seems doubtful — and the right response to the latest nuclear and missile tests is not to offer unconditional dialogue. What is needed is a unified and coherent message from the United States and its allies. Instead, Mr. Trump stirs division and confusion. He threatens “fire and fury” one day, then his secretaries of defense and state respond by emphasizing diplomacy or saying all options are on the table. Mr. Trump prematurely announced on Aug. 16 that he detected restraint by Mr. Kim. On Sunday, he was counterproductively chiding South Korea for its “appeasement” of the North and unrealistically threatening an end to all U.S. trade with “any country doing business with North Korea.”

Mr. Trump seems oblivious to the imperative that South Korea and Japan perceive rock-solid support from the United States, and that North Korea see a united front against it. On top of his insulting tweets, The Post reported this weekend that the president wants to scrap the South Korea free-trade agreement. This would be a wildly irresponsible move, undermining relations with Seoul at the worst possible moment. It would be a gift to Mr. Kim, who dreams of splitting the bond between Seoul and Washington.

As it is, Mr. Kim may well see the confusion in response to his latest provocations, and feel undeterred. That only adds to the dangers.