Cuba was the last major Spanish colony to gain independence, following a 50-year struggle begun in 1850. Jose Marti, Cuba's national hero, began the final push for independence in 1895. In 1898, after the USS Maine sunk in Havana Harbor on February 15 due to an explosion of undetermined origin, the United States entered the conflict. In December of that year Spain relinquished control of Cuba to the United States with the Treaty of Paris. On May 20, 1902, the United States granted Cuba its independence, but retained the right to intervene to preserve Cuban independence and stability under the Platt Amendment. In 1934, the amendment was repealed and the United States and Cuba reaffirmed the 1903 agreement which leased the Guantanamo Bay naval base to the United States.
Cuba was often ruled by military figures, who either obtained or remained in power by force. Fulgencio Batista, an army sergeant, organized a non-commissioned officer revolt in September 1933 and wielded significant power behind the scenes until he was elected president in 1940. Batista was voted out of office in 1944. Running for president again in 1952, Batista seized power in a bloodless coup three months before the election was to take place, suspended the balloting, and began ruling by decree.
Fidel Castro, who was running for a seat in the Chamber of Representatives, circulated a petition to depose Batista's government on the grounds that it had illegitimately suspended the electoral process. On July 26, 1953 Castro led a failed attack on the Moncada army barracks near Santiago de Cuba and was jailed and subsequently went into exile in Mexico. While in Mexico, Castro organized the 26th of July Movement with the goal of overthrowing Batista, and the group sailed to Cuba on board the yatch Granma landing in the eastern part of the island in December 1956.
Batista's dictatorial rule fueled increasing popular discontent and the rise of active urban resistance groups, a fertile political environment for Castro's 26th of July Movement. Faced with a corrupt and ineffective military itself dispirited by a U.S. Government embargo on weapons sales to Cuba and public indignation and revulsion at his brutality toward opponents, Batista fled on January 1, 1959. Within months of taking control, Castro moved to consolidate power by marginalizing other resistance figures and imprisoning or executing opponents. As the revolution became more radical, hundreds of thousands of Cubans fled the island.
Castro declared Cuba a socialist state on April 16, 1961. For the next 30 years, Castro pursued close relations with the Soviet Union until the demise of the U.S.S.R. in 1991. Relations between the U.S. and Cuba deteriorated rapidly as the Cuban regime expropriated U.S. properties and moved towards adoption of a one-party Communist system. In response, the United States imposed an embargo on Cuba in October 1960, and broke diplomatic relations on January 3, 1961. Tensions between the two governments peaked during the October 1962 missile crisis.