The United States and the Soviet Union have been involved in a dangerous competition for global dominance since the end of World War 2.
The Cuban Missile Crisis, which took place in October 1962, brought the two countries close two war over the presence of Soviet nuclear armed missiles in Cuba.
Cuba became a communist nation under the rule of Fidel Castro in the year 1959 and diplomatic relations worsened with the US. US President Eisenhower started a secret plan called, “A Program of Covert Action Against the Castro Regime” in 1960. It was codified as JMARC and its plan was to overthrow the Castro regime. His plan failed miserably and triggered an even bigger escalation by increasing tensions between Cuba and the US and therefore between the USSR and the US. Soviet Premier Nikita Khrushchev noticed the opportunity to strengthen the relationship between the Soviet Union and Cuba lead by Fidel Castro. He made a pact with Castro promising to defend Cuba from the United States by using Soviet arms.
The US’s relations with Cuba came essentially to a standstill, especially following the Bay of Pigs Invasion. In May 1960, Khrushchev started shipping ballistic missiles and technicians to Cuba, to operate on them believing that US President Kennedy was weak and would not react to this move made by the Soviets.
He thought that the United States would take no steps to prevent the installation of Soviet medium- and intermediate-range ballistic missiles in Cuba, while the US had recently placed missiles in Turkey.
These missiles would have been able to hit big parts of the eastern United States within a few minutes, when launched from Cuba. Following, the CIA trained Cuban exiles whose task was to invade Cuba in 1961, but who were stopped by Castro’s army. By that time John F. Kennedy had become President of the US July 1962, and the US learned that the Soviet Union had begun the shipment of missile to Cuba, and in August they learned that the Soviets had technicians and new military constructions in Cuba.
On October 14, 1962, a U-2 spy plane flying over Cuba, found evidence of nuclear missile, which were under construction. On October 22, 1962, Kennedy blockaded Cuba. The USSR’s presence in Cuba meant a significant threat to the integrity and safety of the US.
Because of that, JFK came together with his executive committee (Ex-Comm) to deal with the crisis and plan further steps. The group took two sides: There were the ones who wanted a military solution, like an invasion or an air strike on Cuba, and on the other side there were those who wanted a diplomatic solution to remove the missiles.
They decided that if the USSR did not agree to stop importing its missiles to the island, JFK would consider imposing quarantine on the island.
By that time, the US and the Soviet Union stood on the edge of a nuclear war, but Khrushchev capitulated six days later and the missiles were dismantled. In return, Kennedy disbanded its own missile sites in Turkey. The most confrontational period in US-Soviet relations since World War II was at an end.
It was soon after, that the famous "hotline" was installed, which should help the US and the Soviet Union to resolve future conflicts.