In 2012 I had a 3000km long trip from Barcelona to Sevilla by southern coastline, Andalucia. We stumbled upon one of these coastal watchtowers that still occupy imagination and focus of many.
For centuries the people of Andalucia lived in fear of attack by the pirates of the Barbary Coast, hungry for treasure and slaves. The swift corsair galleys could appear from nowhere, strike at an undefended stretch of coast, disappear over the horizon and re-appear hours or days later in another vulnerable spot far faster than any land based force, even of cavalry, could react.
The only protection for most people was to run and hide - either within the walls of the nearest garrison town or simply by taking to the hills until the coast was clear - until “no hay moros en la costa” (there are no Moors on the coast) - an expression which still survives today.
Text take from: https://suite101.com/a/the-coastal-towers-of-andalucia-in-spain-a93062