In colonial times Chiloé was an important bulwark in the defence against Dutch and British incursions to Chile and Patagonia. The archipelago was the last Spanish possession in Chile successfully repelling patriot invasions until 1826. In the 19th century the archipelago was a starting point for the Chilean colonisation of Patagonia. Not only were major expeditions assembled in Chiloé but thousands of Chilotes migrated to the sparsely populated mainland to work in sheep-raising estancias, as railway navvies, or become independent settlers. Belief in witchcraft has been common in the archipelago reaching such influence, that in 1880 Chilean authorities put on trial warlocks said to rule the archipelago through a secret society.