Formally announcing for the first time that North Korea was behind a ransomware attack that briefly crippled computers around the world, White House Homeland Security Adviser Tom Bossert also praised the man who stopped it.

Marcus Hutchins, however, will still stand trial on unrelated hacking charges.

Hutchins, now 23, won international praise in May after he analyzed the code behind the ransomware, called WannaCry, realizing that it had a built-in URL for an unregistered website. Curious, Hutchins registered that URL, activating a kill switch that stopped the virus from spreading. Three months later, the FBI arrested him in Las Vegas’s McCarran airport, accusing him of helping in 2014 to create and distribute a little-used malware, nicknamed Kronos, that could steal banking credentials.

“I will note that to some degree we got lucky. In a lot of ways in the United States we were well prepared,” Bossert said at a White House news conference Tuesday. “But we also had a programmer that was sophisticated, that noticed a glitch in the malware, a kill switch and then acted to kill it.”

Bossert added, “He took a risk but it worked, it caused a lot of benefit. So we’ll give him that. Next time we’re not gonna get so lucky.”