Michael Dobbs is the author of “One Minute to Midnight: Kennedy, Khrushchev, and Castro on the Brink of Nuclear War.”

Hearing President Trump threatening to bring “fire and fury” down on North Korea because of its nuclear defiance reminded me of an incident during the Cuban missile crisis. The State Department had gotten slightly ahead of the White House by mentioning the possibility of “further action” by Washington — and President John F. Kennedy was irate.

He called State Department spokesman Lincoln White to reprimand him personally and to stress the need to coordinate and calibrate all public statements. Otherwise, an already dangerous crisis could escalate uncontrollably. “We got to get this under control, Linc,” he fumed. “You have to be goddamn careful!”

(Adriana Usero,Kate Woodsome/The Washington Post)

Studying the 1962 nuclear showdown for my book “One Minute to Midnight,” I concluded that the real risk of war arose not from the conscious designs of Kennedy, Nikita Khrushchev or even Fidel Castro. It stemmed from the possibility that the opposing sides could trigger a nuclear conflict that nobody wanted through miscommunication and freak accidents, which became increasingly likely at higher levels of military alert. The same is almost certainly true of the present crisis with North Korea.

The nightmare of an accidental nuclear war was very much on Kennedy’s mind during the “13 days” when the world came closer than ever before, or since, to blowing itself up. He had recently read a book by historian Barbara Tuchman, “The Guns of August,” that described how a previous generation of statesmen had blundered into World War I, with nobody really understanding why. Kennedy was determined to avoid a similar chain of unpredictable events involving atomic weapons.

For a student of the Cuban missile crisis, the fact that our current Twitter-happy commander in chief is surrounded by sensible, highly competent generals is only partly reassuring. The missile crisis showed that there are some decisions that only a president can make. There were times when JFK was in a minority of one in the Excomm, the committee set up to manage the crisis, in his willingness to compromise with Khrushchev. Only the president had the overarching sense of history to consider the interests of future generations of Americans, and ultimately all of humanity.

As is no doubt the case today, the generals assured Kennedy in October 1962 that the United States enjoyed overwhelming nuclear superiority over its adversary and could easily wipe the Soviet Union off the map. But this did not comfort the president, who asked the obvious question: How many Americans would die if just one Soviet missile landed on U.S. soil? The answer was 600,000.

“That’s the total number of casualties in the Civil War,” JFK exploded. “And we haven’t got over that in a hundred years.” He later acknowledged that the 24 intermediate-range Soviet missiles in Cuba constituted “a substantial deterrent to me.”

Given the explosive rhetoric of North Korean leader Kim Jong Un, it is understandable that President Trump should be tempted to respond in kind. Classic game theory teaches us that you can gain an advantage over your opponent if you can convince him that you are madder than he is. In the game of chicken, with two cars heading for a frontal collision, the driver who swerves out of the way first loses.

During the Cuban missile crisis, the “crazy man” role was played to perfection by Castro, the only leading actor who was seriously prepared to risk a nuclear war. Patria o muerte — “fatherland or death” — was, after all, the slogan of the Cuban revolution. Assuming the role of madman has always been part of the arsenal of the weak against the strong, whether in the case of Cuba or North Korea or the Islamic State. It gives the weaker player an advantage it would not otherwise have.

(Jenny Starrs,Bastien Inzaurralde/The Washington Post)

Playing chicken is, however, a dangerous indulgence for the leader of a nuclear superpower. During the 1962 crisis, the two “rational” players — Kennedy and Khrushchev — ended up making common cause against the “madman” Castro. Despite everything that divided them, they had a sneaking sympathy for each other, an idea expressed most poignantly by Jackie Kennedy in a handwritten letter to the Soviet leader following her husband’s assassination.

“You and he were adversaries, but you were allied in a determination that the world should not be blown up,” she wrote Khrushchev. “The danger which troubled my husband was that war might be started not so much by the big men as by the little ones. While big men know the needs for self-control and restraint, little men are sometimes moved more by fear and pride.”

As President Trump girds for a possible nuclear confrontation with North Korea, we can only hope that he will prove to be a big man rather than a little one. Out-crazying Kim Jong Un is a scary proposition. Game theory also teaches us that, if neither driver swerves, everybody goes up in flames.