 At the end of the war, with the United States gaining independence, Britain transferred East Florida to Spain.The British colonists left, but Spain sent only a few soldiers and settlers to the city.The Spanish recaptured Pensacola in 1781 and retained control until 1821 (excepting three short-lived invasions by American General Andrew Jackson in 1813, 1814, and 1818).