José María Castro Madriz (1 September 1818 – 4 April 1892) was a Costa Rican lawyer, academic, diplomat, and politician. He served twice as President of Costa Rica, from 1848 to 1849, and from 1866 to 1868. On both occasions he was prevented from completing his term of office by military coups. During his first administration, on 31 August 1848, he formally declared Costa Rica an independent republic, definitively severing Costa Rica's ties to the moribund Federal Republic of Central America.
José María Castro Madriz
|1st and 5th President of Costa Rica
31 August 1848 – 16 November 1849
|José María Alfaro Zamora
Juan Rafael Mora
Manuel José Carazo Bonilla
|José María Alfaro Zamora
|Miguel Mora Porras
8 May 1866 – 1 November 1868
|1 September 1818
San José, New Spain
|4 April 1892 (age 73)
San José, Costa Rica
Castro was born in San José and educated at the University of León in Nicaragua, where he graduated as bachelor of philosophy and doctor of law. He occupied many public offices throughout his life, both before and after serving as President. He was the rector of the national University (which he had helped to create) for sixteen years, and served several administrations as cabinet minister and ambassador. He also presided over the judiciary (as chief judge of the Supreme Court of Justice from 1860 to 1866 and from 1870 to 1873) and the legislature (as president of the Congress of Deputies in 1844-1845 and of the fourth Constitutional Convention in 1859), making him the only other Costa Rican besides Ricardo Jiménez to have headed all three branches of the government.
An active Freemason, Castro was consistently critical of the political influence of the Roman Catholic Church. He was also a strong defender of freedom of the press at a time when many Costa Rican governments practiced widespread censorship. His constitutional reform of 1848, however, established the most restricted suffrage that ever existed in independent Costa Rica. As president his lack of a committed political base made him an easy target for overthrow by the military. As the minister of foreign affairs, education, justice, public aid, and religious affairs, Castro was the most influential figure in the government of his brother-in-law, President Próspero Fernández (1882–1885), and he was largely responsible for the anti-clerical legislation adopted by that government.
He was married to Pacífica Fernández, who designed the 1848 version of the Costa Rican flag. His daughter Cristina Fernández Castro married Minor C. Keith in 1883. Their grandson, Rafael Yglesias, served as President of Costa Rica from 1894 to 1902.
Inaugurated at age 29, he was the youngest person to ever serve as President of Costa Rica.