The Castle undergoes successive interventions in medieval and modern times, especially in the reigns of D. Dinis, D. Fernando and D. Manuel. What remains of the last intervention is the coat of arms of D. Manuel I, flanked by the Manueline armillary spheres, with the Cross of Christ. With the 1755 earthquake, both the walls and the Paço dos Alcaides, were largely destroyed.
The Castle would again play an important role in 1809, when it was integrated in the Lines of Torres Vedras, as stronghold nº 27. At that time it was again repaired and furnished with 11 pieces of artillery. In this adaptation the castle gate was demolished. The last siege of the Castle took place in late 1846, having served as barracks for the Count of Bonfim's troops. The fortress was bombed by the Duke of Saldanha, with the explosion of the magazine, which almost completely ruined the Palace. Despite its state of ruin, the castle continued to function as a barracks of regular troops until the end of the 19th century, having undergone several repairs. In 1929, the Ministry of War assigned the property to the City Council, which was in charge of conservation and cleaning.
It is a monument classified by Decree No. 41 191, DG, I Series, No. 162, of 18-07-1957.