Hours later, Mr. Mattis issued a written statement that, while not as florid as Mr. Trump’s comments on Tuesday, still held out the possibility of a massive retaliation that could destroy much of North Korea.

“While our State Department is making every effort to resolve this global threat through diplomatic means, it must be noted that the combined allied militaries now possess the most precise, rehearsed and robust defensive and offensive capabilities on Earth,” Mr. Mattis said. North Korea’s military, he added, “will continue to be grossly overmatched by ours and would lose any arms race or conflict it initiates.”

At the urging of the Trump administration, the United Nations Security Council unanimously approved new sanctions against North Korea last Saturday. But even as China and Russia supported the measure, it was unclear how hard they would work to enforce it. Some saw Mr. Trump’s message as aimed at providing an incentive to Beijing to do more to avoid war, although it also risked disrupting the very alignment he had been trying to forge.

Mr. Mattis, in his statement, stressed the international solidarity against North Korea: “Kim Jong-un should take heed of the United Nations Security Council’s unified voice and statements from governments the world over, who agree the D.P.R.K. poses a threat to global security and stability. The D.P.R.K. must choose to stop isolating itself and stand down its pursuit of nuclear weapons.”

While the State Department insisted that the administration was speaking with “one voice,” analysts said that voice was not necessarily a consistent one.

“Clearly there is not a coordinated messaging strategy,” Evan Medeiros, the managing director at the Eurasia Group and a former Asia adviser to President Barack Obama, said by telephone from Tokyo. “This is being put together incrementally and of all the countries and all the issues you deal with, North Korea is not the one to be kludging together statements by the president and cabinet secretaries because the risk of miscalculation is so high.”