A good quarter of the government-protected heritage sites in the Costa Brava are observation towers built in the 15th and 16th centuries. Late Medieval times were the times of the real and tangible piracy threat. The Costa Brava locals had become acutely aware of the pirate-bearing ships from the Ottoman Empire who were often after far more than just livestock or possessions — the Christian slave trade was a regular occurrence in Algeria, Tunisia and Turkey at the time.
To spot a pirate ship early, residents of local coastal pueblos built towers that were handy not only for observation but for defending the town too. Usually, at least two or three dozens of people could hide inside the tower and stay the advancement of the enemy with a handful of rifles.
The structure of many observation towers points to the seriousness with which the locals took the anti-pirate defense. For instance, the famous Torre Valentina tower is only accessible through a trap door 10 meters above the ground that can only be reached with a rope-ladder. A quick storming and capture of such a tower wouldn't be possible.
The piracy wound down in the 19th century, and the towers became obsolete, but many of them are still in excellent shape — compact and unobtrusive, they are rarely demolished, especially with their historical significance taken into account. The most interesting ones have been declared heritage sites.