The United States of Central America (USCA), also known as the Federal Republic of Central America, was a Central American revolutionary republic which existed from 1823 to 1841, with Guatemala City serving as its capital (later San Salvador after 1834). The republic included the present-day countries of Costa Rica, El Salvador, Guatemala, Honduras, and Nicaragua. It gained its independence from the Spanish Empire on 15 September 1821, but the Mexican emperor Agustin de Iturbide sent his general Vicente Filisola to subject the disunited Central America to his rule in 1822. Some saw the abolition of slavery and the creation of free trade as a benefit, but many liberals opposed the Mexican annexation, and the army was ordered to quell dissent. On 1 November 1823, following Iturbide's abdication, Mexico became a republic, and Filisola turned over his power to the National Constituent Assembly, which declared absolute independence on 1 July 1823 and created a republican government.
The liberal-dominated Assembly elected Manuel Jose Arce as president, but he soon turned against his own faction and dissolved the Assembly. El Salvador rose in revolt against federal authority, and Honduras and Nicaragua joined in the rebellion and deposed Arce in 1829. To appease liberal supporters, the capital was moved to San Salvador in 1831. However, opposition to Francisco Morazan's rule led to the provinces again entering a state of rebellion, and, in 1838, the Assembly adjourned with the declaration that the provinces were free to rule themselves as the federal republic dissolved. In 1839, Morazan was exiled as rebels from Guatemala, Honduras, and Nicaragua entered San Salvador, evicting the USCA governing institutions. From 1838 to 1840, the federation descended into civil war between conservatives, liberals, and separatists fighting to secede. The factions were unable to overcome their ideological differences, and, by 1840, four of its five member states declared independence. In February 1841, El Salvador's declaration of independence formally ended the USCA.