The first fortification placed on the banks of the Lima River Foz is believed to date back to the reign of D. Alfonso III, although the earliest certain date is from the 15th century, when a fortress was built there, which would have been completed during the reign of D. Manuel I, as suggested by some Manueline architectural elements, specifically the so-called “Torre da Roqueta”, located on the southwestern bastion of the current fortress.

At the end of the 16th century, the fortress underwent successive improvement works, and it was already under Spanish domination, during the reign of Philip II (Philip I of Portugal), when the current polygonal fortress was built, based on a project designed by Filippo de Terzi, the most famous designer of military buildings of the time.