The great wars of the 20th century were often preceded by a catastrophic miscalculation.
The Germans failed to anticipate that Britain would fight over Belgium in 1914. Stalin failed to anticipate Hitler's invasion of Russia. Japan and America repeatedly misunderstood each other's motives and reactions in the run-up to Pearl Harbor. In 1950, the US failed to anticipate that China would enter the Korean War.
Today, a similar threat - that miscalculation could lead to war - hangs over the Korean peninsula. North Korea's Kim Jong Un and the US' Donald Trump are unpredictable. The dangers that they will miscalculate each other's actions, with catastrophic consequences, are real.
North Korea is such a closed society that even academic specialists struggle to interpret its behaviour. The mainstream view is that Mr Kim's pursuit of advanced nuclear weapons is motivated by a search for security. The North Korean leader has seen what happened to other dictators who failed to acquire these weapons - Saddam Hussein of Iraq and Muammar Gaddafi of Libya - and concluded that only nukes can guarantee his survival.
This view is relatively reassuring because it suggests that Mr Kim is unlikely to use nuclear weapons first. But there are aspects of his behaviour that may not fit this relatively comforting picture. If deterrence is his only concern, why is he apparently going out of his way to provoke the United States, Japan, even China?
This week, North Korea staged its largest nuclear test. Last week, it sent a ballistic missile over Japan. It may be that these actions are necessary steps on the way to achieving the ultimate form of deterrence: a nuclear missile that could hit the US. But the rapid succession of nuclear provocations also makes it much more likely that the US will conclude that Mr Kim really is an irrational actor, the proverbial "madman with nukes". That, in turn, makes it easier to make the case inside the White House for a pre-emptive strike.
The risk that Mr Kim is miscalculating, by potentially provoking a US attack, is raised by the unpredictability of Mr Trump. He has vowed that North Korea will not be allowed to develop nuclear weapons that can threaten the US. He has also repeatedly suggested that he is prepared to stage a pre-emptive military strike, at one point threatening Mr Kim with "fire and fury".
But the US President's efforts to use brinkmanship to force North Korea to back down are undermined by doubts about the credibility of his threats. Mr Stephen Bannon, formerly the President's chief strategist, has stated that the US cannot attack North Korea because of the risk of massive retaliation against South Korea that could kill millions.
Mr Trump's reaction to the latest and most powerful North Korean nuclear test has increased the dangerous confusion about US policy. Rather than stressing American unity with South Korea, the President chose to criticise Seoul for its "appeasement" of Pyongyang. This, combined with the news that Mr Trump is actively considering scrapping the US-South Korea free trade agreement, risks encouraging North Korea to believe its nuclear provocations are working, by splitting the alliance between Seoul and Washington.
Mr Trump has also damaged US credibility, at a crucial moment, by tweeting that America is considering "stopping all trade with any country doing business with North Korea".
Read literally, this would involve ending trade between the US and China, the two largest economies in the world - an action that would throw the global economy into chaos.
Mr Trump's threat underlines his naivety about both trade and international relations. It also suggests that he remains buffeted by competing instincts, with his instinctive protectionism potentially overriding his desire to combat the North Korean nuclear threat.
The confusing signals from the White House increase the dangers of miscalculation, not just in Pyongyang, but also in Seoul, Beijing and Tokyo. With the North's threat mounting, the normal reaction for South Korea would be to move in lockstep with its American protector. But if the government of Mr Moon Jae In concludes the biggest danger is not that North Korea will attack but that Mr Trump will stage a pre-emptive strike, then the South's incentives change. At that point, it might become rational to break publicly with Washington.
The Chinese government faces a similarly complex set of calculations. Mr Trump has repeatedly tried to persuade Beijing to exert more economic pressure on Pyongyang, threatening that Washington will take unilateral military action if China fails to force Mr Kim into line. China has sought to placate Mr Trump by toughening sanctions on North Korea.
But the Chinese also have to consider how Mr Kim might react if he is forced into a corner. The risk that the North Korean leader will use nuclear weapons first will surely rise if he is faced with the prospect of the collapse of his regime - and his own certain death.
These risks would be difficult to manage even with rational, experienced leaders in power. But the key decision makers are a 71-year-old businessman with a volcanic temper and no relevant experience, and a 33-year-old dictator, surrounded by frightened sycophants.