The castle was founded in a strategic position, on a site settled by Muslim forces during the Iberian occupation, referred to as al-Madan, suggesting that the site was built on mineral extraction in the region or epoch, and referred to in the Geografia Nubiense of Muhammad al-Idrisi, Almada was assaulted and conquered by the combined forces of King D. Afonso and a crusader army. Following its conquest, the settlement's defenses were reinforced and expanded following the foral issued of 1170. King D. Sancho I signed a new foral in 1190. During this period, Almohad forces under the command of caliph Abū Yūssuf Yaʿqūb bin Yūssuf al-Manṣūr following their conquest of the Algarve, advanced to the north, expelling Portuguese forces from citadels in Alcácer do Sal and Palmela, and destroyed the defensive lines in Almada. The Portuguese monarch reconquered the fortifications in 1195, and began the construction of a castle on the site. It was only following the battle of Navas de Tolosa, when Christian forces registered a decisive victory over Muslim forces in the Iberian peninsula, that the lost territories were recaptured from the Tagus to Évora. On 24 February 1255, King D. Afonso III reconfirmed to the Order of Santiago, in the person of Master Paio Peres Correia and his commander, the control of the castles first donated by D. Sancho I, and later confirmed by Afonso II, namely Alcácer do Sal, Almadar do Sal, Almada, Arruda and Palmela. The castle was expanded and reinforced during the reign of King D. Dinis I and, later, under the direction of King Ferdinand. During the succession crisis of 1383-1385, when the city of Lisbon was under siege, Almada was encircled by forces loyal to Castile, by Condestável D. Nuno Álvares Pereira who was unsuccessful in liberating the region. During the reign of King D. Manuel I a tower was constructed on the south wall of the castle fortifications. During the context of the Portuguese Restoration War, in the reign of King D. Afonso VI 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, but was only reconstructed around 1760, obtaining the actual extent and plan. It was decommissioned in 1825, and Lieutenant Fulgêncio Gomes dos Santos Vale received orders to collect all the arms material onsite, and transfer it the military arsenal in Lisbon. But, the site was garrisoned in 1831, during the context of the Portuguese Civil War. In this period, the site was commanded by Colonel Manuel de Freitas e Paiva. It was visited by King D. Miguel on 18 February 1832. When Liberals advanced into Lisbon, they defeated Miguelists in the Battle of Cova da Piedade on 23 June 1833, forcing their retreat to the Castle of Almada. These forces were defeated on the following day. Between 1865 and 1866 there were repairs completed, in order to coordinate with the various defensive batteries on the southern margin of the Tagus. With the loss of its defensive function, its garrison was reduced and its command assigned to reformist officials, classifying it as a first and second class fort. In 1868, the public garden was inaugurated, providing landscapes and views of the Tagus. When the first Portuguese Republic was proclaimed in the country, it was occupied by Republicans, without any resistance. During the pandemic of 1918, the site was used to serve as a temporary hospital. Following the 26 August 1931 revolt, the revolutionary airman José Manuel Sarmento de Beires left the air base at Alverca, to bomb the fortification. He failed in this attempt, with his bomb falling in the town square, causing the death of three people and injuring many onlookers, including children flying kites in the vicinity. The name of the square was later referred to as the Largo das Vitimas on 26 August 1931, with an inscription inscribed on a plaque to mark the tragic event and its victims. During the Second World War, the castle received new artillery. It was garrisoned until the Carnation Revolution, when the garrison revolted on the day of the event. Following 1976 its installations were occupied by the forces of the GNR Guarda Nacional Republicana, when the building was reconstructed for this purpose. In the 1990s, the municipal authority of Almada, in the ambit of the restoration of the historical centre of Almada Velha, the public garden was reformulated and improved. By the early 21st century, the castle and fortifications became occupied by a contingent of the Destacamento de Intervenção de Setúbal of the GNR.