In late 1945, Castro entered law school at the University of Havana. He became immediately embroiled in the political culture at the University, which was a reflection of the volatile politics in Cuba during that era.
Since the fall of president Gerardo Machado in the 1930s, student politics had degenerated into a form of gangsterismo dominated by fractious action groups, and Castro, believing that the gangs posed a physical threat to his university aspirations, experienced what he later described as "a great moment of decision." He returned to the university from a brief hiatus to involve himself fully in the various violent battles and disputes which surrounded university elections, and was to be implicated in a number of shootings linked to Rolando Masferrer's MSR action group. "To not return", said Castro later, "would be to give in to bullies, to abandon my beliefs". Rivalries were so intense that Castro apparently collaborated in an attempt on Masferrer's life during this period, while Masferrer, whose paramilitary group Les Tigres later became an instrument of state violence under Batista, perennially hunted the younger student seeking violent retribution.
In 1947, growing increasingly passionate about social justice, Castro joined the Partido Ortodoxo which had been newly formed by Eduardo Chibás. A charismatic figure, Chibás was running for president against the incumbent Ramón Grau San Martín who had allowed rampant corruption to flourish during his term. The Partido Ortodoxo publicly exposed corruption and demanded government and social reform. It aimed to instill a strong sense of national identity among Cubans, establish Cuban economic independence and freedom from the United States, and dismantle the power of the elite over Cuban politics. Though Chibás lost the election, Castro, considering Chibás his mentor, remained committed to his cause, working fervently on his behalf. In 1951, while running for president again, Chibás shot himself in the stomach during a radio broadcast. Castro was present and accompanied him to the hospital where he died.
Fidel Castro's role in the circumstances surrounding the assassination of Jorge Eliécer Gaitán in Bogota, Colombia on April 9, 1948--and the massive riots that followed--has been the object of speculation by James M. Roberts of The Heritage Foundation. However, the following account seems to be generally agreed upon: In early April, Castro traveled to Bogotá for a political conference of Latin American students that coincided with the ninth meeting of the Pan-American Union Conference. The students had planned to use this opportunity to distribute pamphlets protesting United States dominance of the Western Hemisphere and to foment discontent. A few days after the conference began, the populist Colombian Liberal Party leader and presidential candidate Gaitán was shot by an unknown young man with a .32 caliber handgun, triggering massive riots in the streets in which many (mostly poor workers) were injured or killed. Rioting and looting spread to other cities in Colombia, beginning an era of turbulence that became known as "La Violencia". The students were caught up in the violence and chaos rocking the city, picking up rifles and roaming the streets distributing anti-United States material and stirring a revolt. When Castro was pursued by the Colombian authorities for his role in the riots, he took refuge in the Cuban Embassy and was flown back to Havana.
Castro returned to Cuba and married Mirta Díaz Balart, a student from a wealthy Cuban family through which he was exposed to the lifestyle of the Cuban elite. In 1950 he graduated from law school with a Doctor of Laws degree and began practicing law in a small partnership in Havana. By now he had become well known for his passionately nationalistic views and his intense opposition to the influence of the United States on Cuban internal affairs. Increasingly interested in a career in politics, Castro had become a candidate for a seat in the Cuban parliament when General Fulgencio Batista led a coup d'état in 1952, successfully overthrowing the government of President Carlos Prío Socarrás and canceling the election.
Batista established himself as de facto leader with the support of establishment elements of Cuban society and powerful Cuban agencies. His government was formally recognized by the United States, buttressing his power. Castro, nearing thirty, was now a politician without a legitimate platform and thus he broke away from the Partido Ortodoxo to marshal legal arguments based on the Constitution of 1940 to formally charge Batista with violating the constitution. His petition, entitled Zarpazo, was denied by the Court of Constitutional Guarantees and he was not allowed a hearing. This experience formed the foundation for Castro's opposition to the Batista government and convinced him that revolution was the only way to depose Batista.