It comes down to men trapped in a tin can, contemplating whether to go down in a blaze of radioactive glory.

It is commonly accepted that the world has never come closer to nuclear war than during the Cuban Missile Crisis, when the United States confronted Soviet Union over its deployment of ballistic nuclear missiles to Cuba. But in popular imagination, the decisions for war would have come from national leaders sitting in the comfort of executive offices in Washington or Moscow.

In fact, that decision was nearly taken out of Khrushchev and Kennedy’s hands by a group of men in the throes of dehydration and CO2 poisoning as they sat in a malfunctioning submarine surrounded by U.S. destroyers, unable to consult with Moscow.

Two officers gave the order to prepare a nuclear weapon for launch.

Fortunately, they brought their boss with them.

The origin of the Cuban Missile Crisis in fact lay in Operation Anadyr, the Soviet plan to covertly deploy fifty thousand personnel and their heavy weapons to Cuba by sea. Anadyr remains a masterpiece of operational security. Even the name Anadyr itself, referencing a river in Russia, was meant to deflect attention from its actual goals. Soviet diplomats prepared a cover story by boasting of a major civilian development program in Cuba. Meanwhile, orders for the troop deployments were transmitted by courier, and the troops and ship captains did not learn about their actual destination until they were given letters by KGB agents at sea.

A total of eighty-six Soviet ships transferred an entire motorized rifle division to Cuba, as well as forty MiG-21 jet fighters, two anti-aircraft divisions with SA-2 surface-to-air missiles (SAMs), sixteen ballistic missile launchers loaded to fire R-12 and R-14 missiles, six Il-28 jet bombers, and twelve FROG-3 tactical ballistic missile systems. The last three systems came with their own nuclear warheads. The troops and equipment were mostly concealed from sight on the ships, though U.S. Navy aircraft did spot some of the SAMs on one transport on September 4. On the whole, however, the Soviet deception was a remarkable success.

The problem was that it wasn’t possible to deploy such a large force on the ground without being detected. On October 14, a U.S. U-2 spy plane photographed the Soviet ballistic missiles at San Cristobal, leading to the missile crisis. Eight days later, Kennedy ordered a naval blockade of Cuba. It would involve hundreds of ships, including four aircraft carriers, as well as numerous additional shore-based patrol planes.

The Soviet Union remained outwardly defiant of the blockade—but mostly turned its ships around. A small number of Soviet ships did attempt to run the blockade—but they were the exception. Weeks earlier, the Soviet Union had set in to motion Operation Kama to deploy four Foxtrot-class diesel submarines of the Sixty-Ninth Torpedo Submarine Brigade to the Cuban harbor of Mariel. The subs were numbered B-4, B-36, B-59 and B-130.

Command personnel from the brigade were attached B-4 and B-59, including Chief of Staff Vasili Arkhipov, who had earlier distinguished himself as the executive officer of the nuclear submarine K-19, which narrowly averted a nuclear meltdown. Arkhipov was badly irradiated during the incident but recovered to live until 1998—unlike many of the K-19’s crew.

The Foxtrot submarines, known as Project 641s in the Soviet Union, were not at the cutting edge of submarine design. Introduced in 1957, they just predated the introduction of teardrop-shaped hulls which offered superior stealth and underwater speed—and in fact were noisier than usual thanks to their three propeller screws. The third deck of the Foxtrots was entirely devoted to enormous batteries, allowing the diesel subs to operate underwater for ten days before needing to surface—but they could only sustain 2.3 miles per hour at maximum endurance, and the crew of seventy-eight was left with the absolute minimum of living space. Fatefully, the submarine’s cooling systems were not designed with tropical waters in mind.

Two other submarines would later be dispatched: the Zulu-class B-75, which escorted a Soviet transport carrying ballistic missiles, and B-88, which deployed off Pearl Harbor, Hawaii to prepare a surprise attack (again!) in the event that war broke out. These submarines do not appear to have been detected by the U.S. Navy.

The flotilla of Foxtrots sailed from the Kola peninsula on October 1 and managed to evade NATO Neptune and Shackleton antisubmarine aircraft in the North Atlantic. However, as they approached Cuba, they still needed to surface regularly to recharge their batteries.

Living conditions in the submerged submarines rapidly grew intolerable. The Foxtrots’ cooling systems broke down and temperatures rose to a range of 100 to 140 degrees Fahrenheit. CO2 began to build up, worsening the physical and mental condition of the crew. A lack of fresh water led to widespread dehydration, and infected rashes broke out across the entire crew.

On October 23, Defense Secretary McNamara authorized U.S. ships to use special Practice Depth Charges, or PDCs. The grenade-sized charges were intended as a means of signaling to the submarines that they had been detected, compelling them to surface. However, the blasts damaged the Soviet subs’ radio antennae and terrorized the crews, who could not easily distinguish the signaling charges from real depth charges. Although the United States notified Moscow of its “Submarine Surfacing and Identification Procedures,” the message did not make it to the subs of the Sixty-Ninth brigade.

The U.S. Navy did not realize the risk of the cat-and-mouse game they were playing with the Soviet subs. In addition to the twenty-one regular torpedoes they carried, each Foxtrot was armed with a single “Special Weapon”: a T-5 torpedo that could be armed with a RDS-9 nuclear warhead. The T-5s had a range of ten kilometers and were designed to detonate thirty-five meters under water and rupture the hulls of nearby ships through the shockwave. Sources disagree as to whether the T-5s had small 3.5- to 5-kiloton warheads, or fifteen-kiloton warheads that could well have destroyed the firer. Regardless, setting off any nuke in the Caribbean would likely have incited a chain reaction of nuclear retaliation.

According to some accounts, Capt. Nikolai Shumkov on board B-130 ordered the arming of a nuclear torpedo—but later maintained he did so to impress Moscow with his dedication to the mission. B-130’s political officer objected, and Shumkov ultimately relented, noting that “we would go up with it” if they fired the torpedo and surfaced B-130. In the end, all three of B-130’s diesel engines broke down. With its battery power exhausted, it was forced to surface directly in front of the pursuing destroyer USS Blandy on October 30. B-130 had to be brought home to Murmansk by a tug.

The nearby B-36, under Capt. Alexei Dubivko, was chased by the destroyer Charles P. Cecil. Dubivko maintains that the destroyer nearly rammed B-36 while it was attempting to surface. B-36, too, ran out of battery and was forced to surface on October 31 and head back for home.

However, the most dangerous incident occurred days earlier on October 27 at the time of maximum tension between Moscow and Washington, when patrol aircraft forced B-59 to submerge with almost no battery accumulated. The American destroyer USS Beale began pelting the Soviet sub with PDCs. It was soon joined by ten additional destroyers from the USS Randolph carrier task force.

Communication Officer Victor Orlov recalled of the hours-long bombardment, “It felt like sitting in a metal barrel with someone hitting it with a sledgehammer. The crew was in shock.” Capt. Valentin Savitsky stubbornly kept B-59 submerged as the temperature built up to 122 degrees Fahrenheit and oxygen steadily depleted, causing the crew to begin fainting.

Russian sailor Anatoly Andreyev described the deteriorating condition of B-59’s crew in a series of diary entries addressed to his wife:

For four days we haven’t been able to get a breath of fresh air, to emerge at least to periscope depth. The compartments are hot and stuffy. . . . It’s getting hard to breathe in here, too much CO2, but no one wants to leave, as it is slightly cooler here. I barely made it through my previous watch. I feel faint all over, slightly dizzy, and I am also showing the results of this way of life, something like hives.

Of Captain Savitsky, Andreyev wrote: “The worst thing is that the commander’s nerves are shot to hell, he’s yelling at everyone and torturing himself. . . . He is already becoming paranoid, scared of his own shadow. He’s hard to deal with. I feel sorry for him and at the same time angry with him for his rash actions.”

Unable to communicate with Moscow, Capt. Valentin Savitsky concluded that war had already broken out. According to Orlov, Savitsky ordered the crew to arm his submarine’s nuclear torpedo and prep it for firing at USS Randolph. “There may be a war raging up there and we are trapped here turning somersaults!” Orlov recalled Savitsky saying. “We are going to hit them hard. We shall die ourselves, sink them all but not stain the navy’s honor!”

His political officer, Ivan Maslennikov, concurred with the order.