The castle of Leiria was built by D. Afonso Henriques for the purpose of creating a line of defense against the Arabs.
In the early 16th century D. Manuel ordered a sacristy to be built between the main chapel and the bell tower.
[1] At the end of the 19th century restoration of the castle started in 1915 by the initiative of Liga dos Amigos do Castelo.
[2] The castle hosted important events as the meetings of the first courts called by D. Afonso III; became the residence of D. Denis and Queen Elizabeth; transformed into a meeting venue for the new court in the reign of D. Ferdinand I and the marriage of D. João I's son D. Afonso was celebrated in this castle as well.
[1][4] Paços Reais (Royal Palace), the Church of Nossa Senhora da Pena, Menagem Tower, the former Collegiate space, and medieval barns are located inside the complex.