In 1816 the United Kingdom formally annexed the islands, ruling them from the Cape Colony in South Africa. It was a measure to ensure that the French would be unable to use the islands as a base for a rescue operation to free Napoleon Bonaparte from his prison on Saint Helena. The occupation also prevented the United States from using Tristan da Cunha as a base, as they had during the War of 1812.