In the same year, Averroes was appointed "qadi" (judge) in Seville. In 1171 he became "qadi" in his hometown of Córdoba. As "qadi" he would decide cases and give "fatwa"s (legal opinions) based on the Islamic law ("sharia"). The rate of his writing increased during this time despite other obligations and his travels within the Almohad empire. He also took the opportunity from his travels to conduct astronomical researches. Many of his works produced between 1169 and 1179 were dated in Seville rather than Córdoba. In 1179 he was again appointed "qadi" in Seville. In 1182 he succeeded his friend Ibn Tufayl as court physician and later the same year he was appointed the chief "qadi" of Córdoba, a prestigious office that had once been held by his grandfather.