Between the 13th and 14th centuries, the rural community of Calpe was walled in order to protect it from Moorish attacks. Its coastal location meant that the community suffered from continuous pirate attacks, which is why Carlos V ordered that the walls be repaired in the 16th century. Those who lived nearby had to access the citadel through a single gate known as "El Portalet".
The harshest attack took place in 1637. Berber pirates invaded the town without being seen. The guards were sleeping, so they climbed over the walls using ladders. During the attack, they took virtually every resident captive.
Another of the most important attacks on the town, which is the origin of its patron saint festivities, occurred on October 22nd, 1744. After this pirate assault a project to fortify the town was started, and a second wall that surrounds the suburb and the old citadel was built. The "Torreó de la Peça" is named after a small fort destroyed in the 20th century that once contained an artillery piece.