It was the cathedral episcopal see of the Roman Catholic Diocese of Baeza, which has a Visigothic period, was suppressed after some time under Moorish rule and was shortly restored after the Reconquista under the Kingdom of Castile in the thirteenth century, but suppressed for good, never again to regain (co-)cathedral status.
In the Muslim era, Ibn al-Abbar mentions that once upon a time, a judge by the name of Ali bin Abdur Rahman Al-Himyari (d.~560 A.H/1166) was the chief imam and orator of the major mosque - see entry 2745 of Takmilah.
His tenure as imam possibly may have coincided with Alfonso VII’s capture of the mosque in 1147 and his temporary conversion of it to a cathedral.
The apse still maintains Gothic tracery, but in the 16th-century a major reconstruction by Andrés de Vandelvira in Renaissance-style created the present church.
[2] The church forms part of a UNESCO World Heritage Site with other monuments in Baeza and in the nearby city of Úbeda.