In privileged place in strategic and defensive terms, with easy access to the river and surrounded by fertile land for agriculture, the castle was a member of call Tagus Line to medieval times. Currently there are only a few sections of its walls and the call Cabaças Tower.
At the time of Independence of Portugal, before advancing to the South of the Portuguese forces under the command of King D. Afonso Henriques (1112-1185), the castle was conquered, in March 15, 1147, by surprise in an assault night. On occasion, the sovereign donated all ecclesiastical law of the village to the Knights Templar.
“In the name of the Holy Trinity, Father. Son and Holy Spirit. I, Alfonso, by the grace of God, King of Portugal, beginning my journey to the castle, called Santarém, I proposed in my heart, and I vote, that God by his hand mercy granted, would offer all ecclesiastical law and the riders and most religious of Solomon’s Temple, residing in Jerusalem in defensão of the Holy Sepulchre, some of whom accompanied me in this company. And because the Lord made me so great mercy that deducted prosperous end my desire, so I, Afonso, aforesaid king, with my wife the Queen Mafalda, make donation to the nominated riders of all ecclesiastical law of Santarém, so the have and have thus they and their successors forever, so do not entremeta it any secular or ecclesiastical person.
Made this scripture in April of 1185 was in 1147 of the Christian era.
In terms of historiography, an important documentary source on the robbery Santarém is the manuscript “De expugnatione Scalabis”, written by monks of the Monastery of Santa Cruz Coimbra to mark the achievement of the sovereign.
The town and its castle were in the path of the Almohad caliph onslaught of Abu Ya’qub Yusuf I, being attacked in 1171. The Muslim forces at the time, were dispersed by the troops of Fernando II of Leon, son of D. Afonso Henriques which at the time was in Santarém. A new Muslim attack materializes in 1181, lying in the city the Prince Sancho, and the assailants retreated before a counteroffensive of defenders.
The defenses of Santarém were severely damaged by the earthquake in 1531.