By 1821, after almost 300 years of colonialism in the region, Spanish occupation ceased in the Americas and independence was granted to Costa Rica. The news of independence resulted in a brief internal struggle between Cartago's conservatives pushing for monarchy rule and a more liberal, federalist movement in San José. After a brief civil war, Costa Rica declared itself a state in the Federal Republic of Central America, and the capital was moved to the liberal center of the nation, San José. For the next few years, Costa Rica struggled within its new community. While repressive elitists vied for power, Costa Rica avoided institutional rule and maintained a relatively classless society. Out of the war and confusion emerged the framework of democratic institutions that would help to resolve social conflict through reform.
Juan Mora Fernández
The most influential period in the development of Costa Rica's democracy was facilitated about by Juan Mora Fernández, the first head of state (1824). Fernández's progressive, liberal leadership helped Costa Rica to develop independently of its neighboring countries, a trend that would forever set it apart from other developing nations in the area. Fernández fortified the burgeoning country's infrastructure: he built roads, established schools, and distributed land grants to anyone willing to plant coffee, the most profitable export crop at that time.
The coffee industry proved to be the most important in unifying the nation. Both the rich, elite plantation owners and the peasant small farm owners developed a mutualistic relationship with one another. Small farm owners were encouraged to grow coffee and then sell the beans to larger plantations, who then prepared the beans for export. As coffee quickly became Costa Rica's principle export in the mid 1800's, plantation owners, now wealthy and powerful, began to invest in their nation's infrastructure. A road was built to transport coffee to Puntarenas, Costa Rica's primary port. Exports went first to Chile, then, as coffee became the new trend in Europe, to Germany and England. With European money flowing into the country (or at least into the hands of a few coffee barons), Costa Rica started to become more cosmopolitan. Europeans immigrated to protect their interests and to stake their claim in Latin America's new tropical frontier. By 1844, a university was founded in San José and liberal European ideologies began to permeate into the political arena.
Juan Rafael Mora
By the mid 1800s, the wealthy coffee growers, or cafeteleros, were able to use there economic strength to dominate Costa Rica's wavering and unpredictable political scene. In 1849, they ousted the nation's president, José Castro, and replaced him with Juan Rafael Mora, one of the most powerful coffee growers in the country. Mora was articulate, shrewd, and self-made, which earned him respect, especially among his fellow cafeteleros. He won additional adoration as the leader of the armed forces that defended Costa Rica against invasion by William Walker.
Mora did not remain a popular figure however. He was regarded as overly ambitious, and many felt that their leader had forfeited sound domestic policy for the pursuit of his own career. In addition, he was accused for an outbreak of cholera that claimed the lives of almost ten percent of the population. Despite immense opposition, Mora manipulated the election of 1859 to win, but was ousted by his enemies in August of that same year. The next year, he led a coup against the new president, a fellow cafeteleros. The attempt failed and Mora was executed by a firing squad in 1860. Despite his questionable social policies, his reputation as the savior of Central America has posthumously labeled him a national hero.
The 1860s were marked by short-lived presidential terms decided out of ongoing quarrels between members of the coffee industry elite. Nevertheless, Costa Rica's leaders of this time were both liberal and educated, producing a decade of accelerated growth of infrastructure, especially in education.