The Church of Santa Maria da Alcáçova was founded in 1154, seven years after the conquest of Santarém from the Moors. In accordance with the plan for the construction of the churches at that time, it obeyed an East-West orientation, with its churchyard facing West, it is not known for sure whether next to the current baptismal font, it is leaning north of the cloister.
It was left to the Knights Templar, lords of the ecclesiastical of Santarém, the construction of the Church of Alcáçova, of the invocation of Santa Maria, in an attempt to consecrate the territory of the fortress or citadel of Santarém. In 1192 the Church of Alcáçova was already collegiate, to which D. Sancho I made the distribution of the rents by its 20 canons. In the middle of the 13th century, he assumed the functions of the Royal Chapel, a status he maintained until 1834.
In the Middle Ages, a school was maintained there, which perpetuated its functions until the 18th century. Inside it also lived a community of poor clerics. Its priors and canons stood out in the world of theology, law, music and letters, reaching many notoriety.