The Cuban communist revolutionary and politician Fidel Castro took part in the Cuban Revolution from 1953 to 1959. Following on from his early life, Castro decided to fight for the overthrow of Fulgencio Batista's military junta by founding a paramilitary organization, "The Movement". In July 1953, they launched a failed attack on the Moncada Barracks, during which many militants were killed and Castro was arrested. Placed on trial, he defended his actions and provided his famous "History Will Absolve Me" speech, before being sentenced to 15 years' imprisonment in the Model Prison on the Isla de Pinos. Renaming his group the "26th of July Movement" (MR-26-7), Castro was pardoned by Batista's government in May 1955, claiming they no longer considered him a political threat while offering to give him a place in the government, but he refused. Restructuring the MR-26-7, he fled to Mexico with his brother Raúl Castro, where he met with Argentine Marxist-Leninist Che Guevara, and together they assembled a small revolutionary force intent on overthrowing Batista.

In November 1956, Castro and 81 revolutionaries sailed from Mexico aboard the Granma, crash-landing near to Los Cayuelos. Attacked by Batista's forces, they fled to the Sierra Maestra mountain range, where the 19 survivors set up an encampment from which they waged guerrilla war against the army. Boosted by new recruits that increased the guerilla army's numbers to 200, they co-ordinated their attacks with the actions of other revolutionaries across Cuba, and Castro became an international celebrity after being interviewed by The New York Times. In 1958, Batista launched a counter-offensive, Operation Verano, but his army's use of conventional warfare was overwhelmed by Castro's guerrilla tactics, and the MR-26-7 eventually pushed out of the Sierra Maestra and took control of most of Oriente and Las Villas. Recognising that he was losing the war, Batista fled to the Dominican Republic while military leader Eulogio Cantillo took control of the country. With revolutionary forces controlling most of Cuba, Castro ordered Cantillo's arrest, before establishing a new government with Manuel Urrutia Lleó as governor and José Miró Cardona as prime minister, ensuring that they enacted laws to erode the power of the Batistanos.

The Movement and the Moncada Barracks attack: 1952–54 In March 1952, Cuban military general Fulgencio Batista seized power in a military coup, with the elected President Carlos Prío Socarrás fleeing to Mexico. Declaring himself president, Batista cancelled the planned presidential elections, describing his new system as "disciplined democracy"; Castro, like many others, considered it a one-man dictatorship.; ; ; . Batista developed ties with the United States, severing diplomatic relations with the Soviet Union, suppressing trade unions and persecuting Cuban socialist groups.; . Intent on opposing Batista's administration, Castro brought several legal cases against them, arguing that Batista had committed sufficient criminal acts to warrant imprisonment and accusing various ministers of breaching labor laws. His lawsuits coming to nothing, Castro began thinking of alternate ways to oust the new government.; .

Dissatisfied with the Partido Ortodoxo'''s non-violent opposition, Castro formed "The Movement", a group consisting of both a civil and a military committee. The former agitated through underground newspaper El Acusador (The Accuser), while the latter armed and trained anti-Batista recruits. With Castro as the Movement's head, the organization was based upon a clandestine cell system, with each cell containing 10 members.; ; . A dozen individuals formed the Movement's nucleus, many also dissatisfied Ortodoxo members, although from July 1952 they went on a recruitment drive, gaining around 1,200 members in a year, organized into over a hundred cells, with the majority coming from Havana's poorer districts.; ; . Although he had close ties to revolutionary socialism, Castro avoided an alliance with the communist PSP, fearing it would frighten away political moderates, but kept in contact with several PSP members, including his brother Raúl.; . He later related that the Movement's members were simply anti-Batista, and few had strong socialist or anti-imperialist views, something which Castro attributed to "the overwhelming weight of the Yankees' ideological and advertising machinery" which he believed suppressed class consciousness among Cuba's working class..

Castro stockpiled weapons for a planned attack on the Moncada Barracks, a military garrison outside Santiago de Cuba, Oriente. Castro's militants intended to dress in army uniforms and arrive at the base on July 25, the festival of St James, when many officers would be away. The rebels would seize control, raid the armory and escape before reinforcements arrived.. Supplied with new weaponry, Castro intended to arm supporters and spark a revolution among Oriente's impoverished cane cutters. The plan was to then seize control of a Santiago radio station, broadcasting the Movement's manifesto, hence promoting further uprisings.. Castro's plan emulated those of the 19th century Cuban independence fighters who had raided Spanish barracks; Castro saw himself as the heir to independence leader and national hero José Martí.; .

Castro gathered 165 revolutionaries for the mission; 138 stationed in Santiago, the other 27 in Bayamo. Mostly young men from Havana and Pinar del Río, Castro insured that – with the exception of himself – none had children,. and ordered his troops not to cause bloodshed unless they met armed resistance.. The attack took place on July 26, 1953, but ran into trouble; 3 of the 16 cars that had set out from Santiago failed to get there. Reaching the barracks, the alarm was raised, with most of the rebels pinned down outside the base by machine gun fire. Those that got inside faced heavy resistance, and 4 were killed before Castro ordered a retreat.; ; . The rebels had suffered 6 fatalities and 15 other casualties, whilst the army suffered 19 dead and 27 wounded..

Meanwhile, some rebels took over a civilian hospital; subsequently stormed by government soldiers, the rebels were rounded up, tortured and 22 were executed without trial.; . Those that had escaped, including Fidel and Raúl, assembled at their base where some debated surrender, while others wished to flee to Havana. Accompanied by 19 comrades, Castro decided to set out for Gran Piedra in the rugged Sierra Maestra mountains several miles to the north, where they could establish a guerrilla base.; ; . In response to the Moncada attack, Batista's government proclaimed martial law, ordering a violent crackdown on dissent and imposing strict censorship of the media. Propaganda broadcast misinformation about the event, claiming that the rebels were communists who had killed hospital patients. Despite this censorship, news and photographs soon spread of the army's use of torture and summary executions in Oriente, causing widespread public and some governmental disapproval.; ; .

Trial and History Will Absolve Me: 1953

Over the following days, the rebels were rounded up, with some being executed and others – including Castro – transported to a prison north of Santiago.; . Believing Castro incapable of planning the attack alone, the government accused Ortodoxo and PSP politicians of involvement, putting 122 defendants on trial on September 21 at the Palace of Justice, Santiago.; ; . Although censored from reporting on it, journalists were permitted to attend, which proved an embarrassment for the Batista administration. Acting as his own defense council, Castro convinced the 3 judges to overrule the army's decision to keep all defendants handcuffed in court, proceeding to argue that the charge with which they were accused – of "organizing an uprising of armed persons against the Constitutional Powers of the State" – was incorrect, for they had risen up against Batista, who had seized power in an unconstitutional manner. When asked who was the intellectual author of the attack, Castro claimed that it was the long deceased national icon José Martí, quoting Martí's works that justified uprisings.; ; .

The trial revealed that the army had tortured suspects, utilizing castration and the gouging out of eyes; the judges agreed to investigate these crimes, embarrassing the army, which tried unsuccessfully to prevent Castro from testifying any further, claiming he was too ill to leave his cell.; . The trial ended on October 5, with the acquittal of most defendants; 55 were sentenced to prison terms of between 7 months and 13 years. Castro was sentenced separately, on October 16, during which he delivered a speech that would be printed under the title of History Will Absolve Me.; ; . Although the maximum penalty for leading an uprising was a 20 years, Castro was sentenced to 15, being imprisoned in the hospital wing of the Model Prison (Presidio Modelo), a relatively comfortable and modern institution on the Isla de Pinos, 60 miles off of Cuba's southwest coast.; ; .

Imprisonment and the 26th of July Movement: 1953–55

Imprisoned with 25 fellow conspirators, Castro renamed "The Movement" the "26th of July Movement" (MR-26-7) in memory of the Moncada attack's date. Forming a school for prisoners, the Abel Santamaría Ideological Academy, Castro organized five hours a day of teaching in ancient and modern history, philosophy and English.; ; . He read widely, enjoying the works of Karl Marx, Vladimir Lenin, and Martí but also reading books by Freud, Kant, Shakespeare, Munthe, Maugham and Dostoyevsky, analyzing them within a Marxist framework. He began reading about Roosevelt's New Deal, believing that something similar should be enacted in Cuba.; ; . Corresponding with supporters outside of prison, he maintained control over the Movement and organized the publication of History Will Absolve Me, with an initial print run of 27,500 copies.; ; . Initially permitted a relatively high amount of freedom within the prison compared to other inmates, he was locked up in solitary confinement after his comrades sang anti-Batista songs on a visit by the President in February 1954.; ; . Meanwhile, Castro's wife Mirta gained employment in the Ministry of the Interior, having been encouraged to do so by her brother, a friend and ally of Batista's. This was kept a secret from Castro, who found out through a radio announcement. Appalled, he raged that he would rather die "a thousand times" than "suffer impotently from such an insult". Both Fidel and Mirta initiated divorce proceedings, with Mirta taking custody of their son Fidelito; this angered Castro, who did not want his son growing up in a bourgeois environment.; ; .