African countries, and with the Ottoman Empire. Latin America In response to the new independence of Spanish colonies in Latin America in 1821, the United States, in cooperation with Great Britain, established the Monroe Doctrine in 1823. This policy declared opposition to European interference in the Americas and left a lasting imprint on the psyche of later American leaders. The failure of Spain to colonize or police Florida led to its purchase by the U.S. in 1821. John Quincy Adams was Secretary of State under President Monroe. Jacksonian Era: 1829–1861 Mexican–American War In 1846 after an intense political debate in which the expansionist Democrats prevailed over the Whigs, the U.S. annexed the Republic of Texas. Mexico never recognized that Texas had achieved independence and promised war should the U.S. annex it. President James K. Polk peacefully resolved a border dispute with Britain regarding Oregon, then sent U.S. Army patrols into the disputed area of Texas. That triggered the Mexican–American War, which the Americans won easily. As a result of the Treaty of Guadalupe Hidalgo in 1848 the U.S. acquired territory that included California, Arizona, and New Mexico, and the Hispanic residents there were given full U.S. citizenship. Nicaraguan canal The British wanted a stable Mexico to block American expansion to the Southwest, but an unstable Mexico attacked Texas and wanted revenge for its defeat. The result was a vast American expansion. The discovery of gold in California in 1848 brought a heavy demand for passage to the gold fields, with the main routes crossing Panama to avoid a very long slow sailing voyage around all of South America. A railroad was built that carried 600,000 despite the dangerous environment in Panama. A canal in Nicaragua was a much healthier and attractive possibility, and American businessman Cornelius Vanderbilt gained the necessary permissions, along with a U.S. treaty with Nicaragua. Britain had long dominated Central America, but American influence was growing, and the small countries look to the United States for protection against British imperialism. However the British were determined to block an American canal, and seized key locations on the Mosquito Coast on the Atlantic that blocked it. The Whigs were in charge in Washington and unlike the bellicose Democrats wanted a business-like peaceful solution. The Whigs took a lesson from the British experience monopolizing the chokepoint of Gibraltar, which produced no end of conflicts, wars, and military and naval expenses