In the early 1800s, revolution and unrest weakened Spain's control over its colonies in the western hemisphere, leaving Spanish Florida vulnerable to British forces, their Native American allies, and Americans. After the Creek War of 1813-1814, refugee Creeks and self-emancipated African Americans fled to Spanish Florida, and amid British interference U.S. General Andrew Jackson invaded and captured Pensacola in late 1814. A few years later, conflicts along the Apalachicola River and in Georgia led to the First Seminole War of 1817-1818, and Jackson again invaded Spanish Florida, capturing Pensacola a second time. Unrest in West and East Florida, spurred by Americans, eventually persuaded Spain to withdraw. The Adams-Onis Treaty of 1819 began the transfer of Florida from Spain to the United States, but political turmoil in Spain delayed implementation until 1821. Official ceremonies in Pensacola on July 17, 1821, marked the American acquisition of Florida, and Andrew Jackson was chosen as provisional territorial governor.