He was born in Córdoba in 1126 to a family of prominent judges—his grandfather was the chief judge of the city. In 1169 he was introduced to the caliph Abu Yaqub Yusuf, who was impressed with his knowledge, became his patron and commissioned many of Averroes' commentaries. Averroes later served multiple terms as a judge in Seville and Córdoba. In 1182, he was appointed as court physician and the chief judge of Córdoba. After Abu Yusuf's death in 1184, he remained in royal favor until he fell into disgrace in 1195. He was targeted on various charges—likely for political reasons—and was exiled to nearby Lucena. He returned to royal favor shortly before his death on 11 December 1198.