Castelldefels Castle, located on the coastal strip between the Garraf massif and Barcelona, is the protective and iconic symbol of the city. The church inside, dating from the 10th century, is the oldest part of the castle and is built on Iberian and Roman remains.
The castle served for centuries for the territorial and defensive control of the city against Arab invasions, and between the 16th and 17th centuries, against attacks by Barbary pirates.
In 1897, Manuel Girona, a Catalan banker and politician, bought and restored the castle, which was in a state of ruins. During the Civil War it was used as a military training centre by the Republican authorities, and later the church became a barracks for the international brigade and a remand prison for deserters and undisciplined people.