Little is known about Averroes's early life. Muhammad ibn Ahmad ibn Muhammad ibn Rushd was born on 14 April 1126 (520 AH) in Córdoba. His family was well known in the city for their public service, especially in the legal and religious fields. He was probably of Muladí and Berber ancestry. His grandfather Abu al-Walid Muhammad (d. 1126) was the chief judge (qadi) of Córdoba and the imam of the Great Mosque of Córdoba under the Almoravids. His father Abu al-Qasim Ahmad was not as celebrated as his grandfather, but was also chief judge until the Almoravids were replaced by the Almohads in 1146.