information:extraction
Independent Nicaragua from 1821 to 1909

The Act of Independence of Central America dissolved the Captaincy General of Guatemala in September 1821, and Nicaragua soon became part of the First Mexican Empire. In July 1823, after the overthrow of the Mexican monarchy in March of the same year, Nicaragua joined the newly formed United Provinces of Central America, a country later known as the Federal Republic of Central America. Nicaragua definitively became an independent republic in 1838.

The early years of independence were characterized by rivalry between the Liberal elite of León and the Conservative elite of Granada, which often degenerated into civil war, particularly during the 1840s and 1850s. Managua rose to undisputed preeminence as the nation's capital in 1852 to allay the rivalry between the two feuding cities. Following the start of the California Gold Rush in 1848, Nicaragua provided a route for travelers from the eastern United States to journey to California by sea, via the San Juan River and Lake Nicaragua. Invited by the Liberals in 1855 to join their struggle against the Conservatives, the American adventurer and filibuster William Walker set himself up as President of Nicaragua after conducting a farcical election in 1856; his presidency lasted less than a year. Military forces from Costa Rica, Honduras, El Salvador, Guatemala, and Nicaragua itself united to drive Walker out of Nicaragua in 1857, bringing three decades of Conservative rule.

Great Britain, which had claimed the Mosquito Coast as a protectorate since 1655, delegated the area to Honduras in 1859 before transferring it to Nicaragua in 1860. The Mosquito Coast remained an autonomous area until 1894. José Santos Zelaya, President of Nicaragua from 1893 to 1909, negotiated the integration of the Mosquito Coast into Nicaragua. In his honor, the region became " Zelaya Department ".

Throughout the late 19th-century, the United States and several European powers considered various schemes to link the Pacific Ocean to the Atlantic by building a canal across Nicaragua.