Free State of Costa Rica

The Free State of Costa Rica was the name acquired by Costa Rica after its split from the Federal Republic of Central America in 1838 and until the proclamation of the First Costa Rican Republic in 1847.

Background
Costa Rica as a member state of the Central American Federation was officially named the State of Costa Rica as established on the Fundamental Law of the State of Costa Rica. As a federal state, Costa Rica was an active member of the Federation respecting the federal laws and electing its representatives to the Federal level. However, with the start of the civil war among Guatemala, Honduras and El Salvador, Costa Rica enacted the Aprilia Law, allowing itself to remain autonomous until constitutional order was restored.

After Francisco Morazán’s victory in the civil war and despite still having the Aprilia Law in function, Costa Rica makes an election for its seats on the Federal Congress electing Félix Romero Menjíbar and Juan Diego Bonilla Nava as deputies and Marquis Manuel María de Peralta and José Francisco Peralta as senators. Bonilla even acted as President of the Federal Congress. Morazán would be elected President in the 1830 Central American federal election and the Central American Supreme Court requested Costa Rica to abrogate the Aprilia Law, which Costa Rica's state congress did on February 3, 1831.

However, after Colombia's annexation of the Costa Rican territory of Bocas del Toro (modern day Panama) without receiving federal help, sympathy for the Federation decreased. Finally on May 30, 1838 the Federal Congress allowed the dissolution of the Federal Republic by letting each of the member states to “organized according to their will” which essentially ended the Federation.

History
Costa Rica's independence from the Federal Republic is proclaimed by then dictator Braulio Carrillo and his Decree of Basis and Guarantees becomes the de facto Constitution. Carrillo would negotiate the debt payment with Great Britain (acquired collectively as part of the Federation) to avoid the impending threat of invasion, encouraged the coffee-growing industry and connected Limón Province through a railroad. But Carrillo was overthrown by Francisco Morazán who proclaimed himself new president. Morazán was planning to re-established the Federation by force using Costa Rica as headquarters and thus, was overthrown and executed to avoid the war that the rest of Central America was already planning against Costa Rica. The leader of the coup Antonio Pinto Soares took power temporary, but he was born in Portugal and thus couldn't be Head of State. Congress chooses José María Alfaro Zamora in his place who ruled between September 27, 1842, and November 28, 1844. Alfaro called for elections for a new Constituent Assembly which enacts the 1844 Constitution.

Francisco María Oreamuno Bonilla is elected Head of State in the 1844 Costa Rican Head of State election but never takes interest in the office and is deposed, replaced by President of the Senate Rafael Moya Murillo from December 17, 1844, till April 30, 1845 and then by Senator José Rafael Gallegos between May 1, 1845, and June 7, 1846.

Gallegos government was highly unpopular due to his attempts to rule by decree and the chaotic situation, a coup deposed him led by Zamora who then called for a new Constituent Assembly and created the 1847 Constitution. The name of the country was changed back to State of Costa Rica, the presidential period was extended to six years, male universal suffrage was established, the bicameral congress was changed to unicameral and the office of the President of the State was created. In the following 1847 Costa Rican Head of State election José María Castro Madriz won over Zamora and his reformation of the 1847 Constitution proclaimed the Republic of Costa Rica ending the existence of the Free State.

Government
The Executive branch of government was in the hands of the Head of State, who was also head of government and elected by popular vote. The Legislature was bicameral for most of its history with a Senate and a House of Deputies both elected by popular vote. The Judiciary was named Supreme Court of Justice of Costa Rica and all branches were independent from each other.