 Complete the following phrase:  The castle suffered heavy damage from the 1755 earthquake, particularly the Palace of the Alcaides and some of the walls. In 1809, it was integrated into the Lines of Torres Vedras, which were defensive lines established by the Duke of Wellington to protect against French invasion during the Peninsular War. Together with the Fort of São Vicente on a hill immediately to its north, the castle, with about 500 soldiers, guarded the main road between Coimbra and Lisbon. As part of the adaptation by the British Royal Engineers for this purpose the castle door was demolished. During the 