 A previous church, also entitled "El Salvador" ("Holy Savior") existed at the time of King Alfonso VII of Castile but it was apparently in ruins, so that the king donated the church of St. Thomas in the city to act as cathedral.The church was built under bishop Esteban, under the patronage of Alfonso VII and his sister, Sancha Raimúndez.The date of construction (1151–1174) is traditionally attested by an epigraphy in the northern side of the transept, although recent discoveries have proven that the church had been already begun in 1139, at the time of bishop Bernardo.