North Korea's apparent test of an intercontinental ballistic missile puts it closer to having the ability to hit the United States with a nuclear warhead. This is an extraordinarily dangerous development.

I worked on North Korea policy in both the George W. Bush and Obama administrations, at the State Department and on the National Security Council, so I know firsthand just how difficult the challenges posed by North Korea are to deal with. I know how constrained the policy options are, and I'm familiar with the many difficult choices involved in selecting from a menu of bad options. And I know the incredibly complicated coordination — both within our own government, and with our allies and partners — that is necessary to implement a strategy to handle it.

But President Donald Trump's reaction to North Korea's missile test was to immediately reach for his phone and sound off with chest-thumping statements on Twitter. This is a very reckless reaction, and one that risks miscalculation by adversary and ally alike.

Trump tweeted on July 3: "North Korea has just launched another missile. Does this guy have anything better to do with his life? Hard to believe that South Korea. . ..."

North Korea will parse every word of Trump's Twitter statements to try to understand what they mean. That's because North Korea uses its own propaganda mouthpieces in an intricate way to signal its intentions to both internal and external audiences. As a government official working on North Korea, I spent hours working with analysts poring over North Korean statements to understand Pyongyang's thinking — whether and how it differs from past statements — and cutting through the bluster to identify the core point it was communicating. Its words are carefully chosen, and it uses different formulas to send different signals.

We know from watching Pyongyang's reactions to previous U.S. statements that it read our words in a similar way. North Korean officials will look for clear signals of intention in Trump's tweets. The problem is, it's not clear that Trump has any idea what his intentions are. He is sending signals that foreign officials will attach meanings to — meanings he may not have intended and might not even realize he's sending.

Trump urged China to "put a heavy move on North Korea and end this nonsense once and for all." It's not clear that he has any idea of what a "heavy move" by China would mean — but Kim Jong Un may well read that to be a call for military action, which in a worst-case scenario could prompt him to take preemptive action. It's not clear what Trump would do to back up whatever a "heavy move" might be, either.

In fact, it's not clear that Trump has any sense of what our strategy toward North Korea is. And despite attempts by members of his Cabinet to articulate a strategy through clearer messaging, such as Secretary of Defense Jim Mattis's speech on North Korea at the Shangri-La Dialogue in June, Trump's words effectively nullify them in Pyongyang — where the idea that the president's statements would matter less than those of his subordinates simply would not compute. The remarks of his Cabinet officials become less credible in foreign capitals when the commander in chief conveys a different message in 140 characters.

That's not the case just for North Korea; Trump's vague words will surely leave Chinese officials scratching their heads, too. It's clear that Trump wants China to do more — he sent off one final tweet before boarding Air Force One for Poland on Wednesday saying "so much for China working with us." But it's simply not as easy as demanding it be so. Getting China to do more on North Korea takes a clear articulation of what we want them to do, and the consequences for failing to do so. We cannot simply wash our hands of the problem and hope China takes care of it. But issuing vague demands on Twitter will only generate confusion in Beijing. Words that Pyongyang could see as threatening military action may actually elicit the opposite reaction in Beijing, as China would probably not want North Korea to believe it is coordinating with the United States on such a plan.

Our allies are also left confused by Trump's messaging. It's not clear what Trump means when he says that its "hard to believe South Korea and Japan will put up with this for much longer." But Tokyo will surely recall Trump's statement during the campaign that if Japan and North Korea went to war, "Good luck. Enjoy yourself, folks." His initial reaction failed to provide the kind of reassurance about defense cooperation that both Seoul and Tokyo expect. South Korea and Japan may well be wondering whether they can still count on the United States.

If our allies, partners and adversaries all attach meaning to Trump's words that are in no way what he intended, the problem isn't just one of mere confusion. Deterring North Korea from taking dangerous actions and reassuring our allies of the credibility of our defense are both critical. But both deterrence and reassurance are based on credibility and capability — and credibility requires clear signaling of intentions.

Trump's vague, blustery words, unattached to any strategy and without any plan to back up whatever he did mean, will undermine both our deterrence and our reassurance, which we have spent decades building. This could lead to miscalculation by North Korea or our allies. Such miscalculation could lead to war: Trump could literally tweet us into a nuclear war.

We know that Kim Jong Un is thin-skinned and will probably take Trump's comment about "this guy" as a personal insult. Or Kim may be confused — after all, just a few months ago, Trump said he would be "honored" to meet with Kim under the right circumstances. To be clear, I don't care at all about Kim's feelings. But I do care about whether an offhand, hotheaded remark could provoke Kim to take actions that would have real consequences. Picking a Twitter fight with a nuclear-armed dictator is not wise — this is not reality TV anymore.

The White House has sent mixed messages about whether it wants Trump's Twitter statements to be considered official statements. But it doesn't matter how the White House wants to spin them — our adversaries and allies alike attach great weight to his every word, and they may calculate decisions based on what Trump says on Twitter.

Bluster and chest-thumping may feel good — but it will not make us safer. The threat posed by North Korea is serious, urgent and reaching a critical point. It requires a real, coordinated strategy in which the president works in concert with his national security team to protect the country.