The oldest structures of the castle of Sant Joan in Blanes date back to the 11th and 12th centuries, built at that time to ensure effective control of the territory and to provide protection against maritime incursions by pirates. The castle was attacked by King Philip III the Bold of France in 1285 and by Genoese troops in 1332; these conflicts caused significant damage to both the fortress and the town, which led to major reforms during the second half of the 14th century. Between the 16th and 18th centuries, the castle entered a period of decline and abandonment that lasted until the current restoration efforts, which began in the mid-20th century.