 Over time, the island endured numerous pirate raids.A Berber-led expedition invaded in 1593, sweeping as far inland as the capital.Various castles were built along the coastline, to protect against these type of attacks.