 During the reign of King D. Manuel I (1495-1521) a tower was constructed on the south wall of the castle fortifications.During the context of the Portuguese Restoration War (1640-1668), in the reign of King D. Afonso VI (1656-1683) the town was defended by the old castle, and was rebuilt in order to maintain the defense of Lisbon, resulting in the construction of a line of bastions.The castle was damaged during the events of the Lisbon earthquake (1 November 1755), but was only reconstructed around 1760, obtaining the actual extent and plan.