Juan Mora Fernandez, elected the nation's first chief of state in 1824, set the tone by ushering in a nine-year period of progressive stability. He established a sound judicial system, founded the nation's first newspaper, and expanded public education. He also encouraged coffee cultivation and gave free land grants to would-be coffee growers. The nation, however, was still riven by rivalry, and in September 1835 the War of the League broke out when San José was attacked by the three other towns. They were unsuccessful and the national flag was planted firmly in San José (see "San José History" for more details).
Braulio Carrillo, who had taken power as a benevolent dictator, established an orderly public administration and new legal codes to replace colonial Spanish law. In 1838, he withdrew Costa Rica from the Central American federation and proclaimed complete independence. In a final show of federalist strength, the Honduran general Francisco Morazan toppled Carrillo in 1842. It was too late. The seeds of independence had taken firm root. Morazan's extranational ambitions and the military draft and direct taxes he imposed soon inspired his overthrow. He was executed within the year.
By now, the reins of power had been taken up by a nouveau elite: the coffee barons, whose growing prosperity led to rivalries between the wealthiest family factions, who vied with each other for political dominance. In 1849, the cafetaleros announced their ascendancy by conspiring to overthrow the nation's first president, José María Castro, an enlightened man who initiated his administration by founding a high school for girls and sponsoring freedom of the press. They chose as Castro's successor Juan Rafael Mora, one of the most powerful personalities among the new coffee aristocracy. Mora is remembered for the remarkable economic growth that marked his first term, and for "saving" the nation from the imperial ambitions of the American adventurer William Walker during his second term (which Mora gained by manipulating the elections). In a display of ingratitude, his countryfolk ousted him from power in 1859; the masses blamed him for the cholera epidemic which claimed the lives of one in every 10 Costa Ricans in the wake of the Walker saga, while the elites were horrified when Mora moved to establish a national bank, which would have undermined their control of credit to the coffee producers. After failing in his own coup against his successor, he was executed . . . a prelude to a second cycle of militarism, for the war of 1856 had introduced Costa Rica to the buying and selling of generals and the establishment of a corps of officers possessing an inflated aura of legitimacy.
The 1860s were marred by power struggles among the ever-powerful coffee elite supported by their respective military cronies. General Tomás Guardia, however, was his own man. In April 1870, he overthrew the government and ruled for 12 years as an iron-willed military strongman backed up by a powerful centralized government of his own making.
True to Costa Rican tradition, Guardia proved himself a progressive thinker and a benefactor of the people. His towering reign set in motion forces that shaped the modern liberal-democratic state. Hardly characteristic of 19th-century despots, he abolished capital punishment, managed to curb the power of the coffee barons, and tamed the use of the army for political means. He utilized coffee earnings and taxation to finance roads and public buildings. And in a landmark revision to the Constitution in 1869, he made "primary education for both sexes obligatory, free, and at the cost of the Nation."
Guardia had a dream: to make the transport of coffee more efficient and more profitable by forging a railroad linking the Central Valley with the Atlantic coast, and thus with America and Europe. The terrain through which he proposed to build his railroad was so forbidding that it gave rise to a saying: "He who once makes the trip to the Caribbean coast is a hero; he who makes it a second time is a fool." Fulfillment of Guardia's dream was the triumph of one man Minor Keith of Brooklyn, New York over a world of risks and logistical nightmares (see opposite page).
Guardia's enlightened administration was a watershed for the nation. The aristocrats gradually came to understand that liberal, orderly, and stable regimes profited their business interests while the instability inherent in reliance on militarism was damaging to it. And the extension of education to every citizen (and the espousal in the free press of European notions of liberalism) raised the consciousness of the masses and made it increasingly difficult for the patrimonial elite to exclude the population from the political process.
More info about Presidential's House: Spanish information about Government of Costa Rica.