 The town was built inland from the coast as a precaution against the constant threat of raids from Barbary pirates.In the 16th century a system of observation towers was erected on the island as a means of protection against pirates.From 14 towers in the municipalities of Andratx and Calvià, 12 still exist.