North Korea was behind the devastating WannaCry ransomware attack that temporarily crippled dozens of NHS trusts, the president of Microsoft has said.

Brad Smith said “all observers in the know” now believe Kim Jong-un’s regime stole the technology needed to create the exploit from the US’ National Security Agency before unleashing it on the world.

The attack in May struck where computers were running outdated software, infecting hundreds of thousands of machines around the world.

Mr Smith said the threat from state-sponsored cyber attacks was increasing.

He told ITV News: “I think over last six months we’ve seen threats come to life, unfortunately, in new and more serious way. The problem has become bigger.

“We need governments to come together as they did in Geneva in 1949 and adopt a new digital Geneva Convention that makes clear that these cyber-attacks against civilians, especially in times of peace, are off-limits and a violation of international law.”

Mr Smith said Microsoft was not to blame for the infection of systems using older operating systems – mainly, in this case, the obsolete Windows XP, for which the company ended mainstream support in 2014.