Britain used Pensacola, FL, as a naval base during the War of 1812. Pensacola was captured by the Americans in 1814. Spain agreed to transfer Florida to the United States in 1819, and the take -over was completed in 1821. Andrew Jackson briefly served as provisional governor. Florida was organized as a territory in 1822, opening the area up to much settlement. Conflicts exploded between Seminole Indians and white settlers, with the latter victorious in the Second Seminole War of 1835-1842. Florida entered the Union as a slave state on March 3, 1845. By 1860 its population was about 140,000, of which 63,000 were African Americans. It seceded from the Union on January 10, 1861, subsequently joining the Confederacy. Most of the state's coastal towns were captured by Union forces early in the war, although Tallahassee remained under Southern control throughout the war. Florida was re-admitted to the Union in 1868, after a new constitution guaranteed to all the right to vote.