President Kennedy authorized the Bay of Pigs invasion in 1961 as part of a broader effort to contain the spread of communism in the Western Hemisphere. At the time, Cuba had recently undergone a revolution led by Fidel Castro, who had aligned the country with the Soviet Union and established a socialist government. The United States viewed Cuba as a potential threat to its national security, particularly given the close proximity of the two countries and the possibility of Soviet military installations being built on the island.