Rule No 1 in international relations: do not assume that your adversary is nuts. Rule No 2: do not underestimate his capacity to inflict serious damage on you. We in the west are currently making both mistakes with regard to North Korea. Our reasons for doing so are, at one level, understandable. In economic terms, the country is a basket case. According to the CIA’s world factbook, its per-capita GDP is $1,800 or less, compared with nearly $40,000 for the UK and $53,000 for the US. Its industrial infrastructure is clapped out and nearly beyond repair; the country suffers from chronic food, energy and electricity shortages and many of its people are malnourished. International sanctions are squeezing it almost to asphyxiation. And, to cap it all, it’s led by a guy whose hairdo is almost as preposterous as Donald Trump’s.

And yet this impoverished basket case has apparently been able to develop nuclear weapons, plus the rocketry needed to deliver them to Los Angeles and its environs. Given the retaliatory capacity of the US, this is widely taken as proof that Kim Jong-un must be out of what might loosely be called his mind. Which is where rule No1 comes in. Kim’s priority is to avoid regime change. He knows that if you have nukes, then no one – not even Trump – is going to try any funny business, especially when it’s clear that a seriously aggressive move by the US would mean the death of hundreds of thousands of South Koreans. The North Korean leader’s rationale for developing nuclear weapons that are ready for deployment is identical to Britain’s rationale for renewing Trident: deterrence.

So “Rocket Man” (as Trump calls him) is rational. He believes, as we do, in mutually assured destruction. He is therefore looking for lower-risk ways of inflicting damage on the US and its South Korean ally. And he’s found one. It’s called “cyber operations” and the North Koreans are getting the hang of it. They’re not as skilled yet as the Chinese and the Russians (not to mention the Americans), but they’re making real progress.

Last year, North Korean hackers nearly pulled off the greatest bank heist in history

And while once the thought that a country with only about 1,000 internet addresses could inflict serious damage on a nuclear-tipped superpower was regarded as preposterous, nobody in Washington (or London, for that matter) is laughing any longer.

Evidence of North Korean prowess in cyber operations has been steadily mounting. The other day, the New York Times provided an instructive progress report. Last year, for example, North Korean hackers nearly pulled off the greatest bank heist in history. They were within a keystroke of nicking a billion dollars from the New York Federal Reserve and were stopped only by a spelling mistake: a bogus withdrawal request misspelled “foundation” as “fandation”. Even so, they got away with $81m.

Two years earlier, they had pulled off a devastating attack on Sony Pictures that resulted in the theft of thousands of documents, the wiping of internal data centres and the destruction of 75% of the company’s servers. Among the haul were contracts, salary lists, film budgets, medical records, staff social security numbers, personal emails – and five entire movies, including one that had not yet been released.

But the coup de grace came last September when the North Koreans penetrated South Korea’s defence data centre – in the HQ of South Korea’s defence network – and stole a trove of top-secret files, including American and South Korean operational plans for wartime action. The documents included OPLAN 5015, the plan for dealing with full-blown war with North Korea, which reportedly included procedures to “decapitate” the North Korean leadership, plus a contingency plan in case of sudden political changes inside North Korea.

In the febrile standoff on the Korean peninsula, this was a tactical masterstroke. But it also indicated the strategic insight that underpins North Korea’s pivot to cyber operations. It suggests that Kim Jong-un and his cronies have understood how digital technology can convert industrial and economic weakness into a strength. The reason why major industrialised countries hold back from responding in kind to one another’s cyber attacks is because their societies are all desperately dependent on complex, fragile and insecure network infrastructures. So all fear the unfathomable consequences of retaliation. And, accordingly, a new doctrine of mutually assured destruction keeps an uneasy peace in cyberspace.

North Korea, however, doesn’t have much of a digital infrastructure and so has less to fear. Which is why Kim may be smarter than we like to think.