The Bahamas was first settled by Amerindians, then invaded and taken-over by British colonizers in 1686. Piracy was rife when the Bahamas was settled and remained an issue into the 1720s. Following the American war of Independence, defeated forces loyal to the crown re-located to the Bahamas, forcing-out a Spanish army who had seized the colony whilst British efforts were focused on the war. Freed slaves from other colonies began to arrive in the Bahamas from 1807; slaves in the Bahamas were freed in 1838. The Bahamas gained its independence from the British in 1973.