North Korean soldiers at a rally this month to celebrate the declaration in November that it had achieved full nuclear statehood.

WASHINGTON — The Trump administration formally accused North Korea on Monday night of creating the WannaCry cyberattack that briefly paralyzed the British health system and placed ransomware on computers in dozens of countries around the world.

President Trump’s homeland security adviser, Thomas P. Bossert, wrote in an op-ed published in The Wall Street Journal that the conclusion was “based on evidence” that he did not disclose. He suggested that the United States would act against North Korea — beyond the sanctions now being imposed for its rapid expansion of its nuclear weapons program, writing, “When we must, the U.S. will act alone to impose costs and consequences for cybermalfeasance.”

The conclusion was not by itself a surprise: The New York Times reported in May that North Korea was the leading suspect in the attack, which encrypted hard drives on hundreds of thousands of computers and demanded the payment of ransom to unlock the data. Later, British officials reported that their forensic evidence and intelligence pointed to Pyongyang, and Mr. Bossert wrote that in recent days, Microsoft and other companies that track major threats have closed pathways that the North’s army of hackers could use for similar breaches.

Still, the assertion by the administration, which officials said would be supported at a White House news conference on Tuesday, was notable for three reasons.

It came almost three years to the week since President Barack Obama, appearing in the White House press room, accused North Korea’s leadership of mounting a similarly sophisticated cyberattack on Sony Pictures Entertainment. The North was enraged that Sony was releasing a comedy, “The Interview,” envisioning a C.I.A.-ordered assassination of Kim Jong-un, the country’s young leader. That was the first time the United States had accused another nation of a direct, destructive online intrusion on an American target.

But the decision…