Muhyi al-Din (or Mujir al-Din) Abu Ali Abd al-Rahim ibn Ali ibn Muhammad ibn al-Hasan al-Lakhmi al-Baysani al-Asqalani, better known by the honorific name al-Qadi al-Fadil (Arabic: القاضي الفاضل, romanized: al-Ḳāḍī al-Fāḍil, lit. 'the Excellent Judge';[1] 3 April 1135 – 26 January 1200) was an official who served the last Fatimid caliphs, and became the secretary and chief counsellor of the first Ayyubid sultan, Saladin.
Born in Ascalon to a qadi and financial official, Qadi al-Fadil went to study in Cairo, the Fatimid capital. He entered the Fatimid chancery, and quickly distinguished himself for the elegance of his prose style. In the early 1160s, he was patronized by the viziers Ruzzik ibn Tala'i and Shawar, rising to become head of the fiscal department supervising the army, and receiving the name by which he is known. Despite his prominent position in the Fatimid state, he quickly sided with the fellow Sunni Saladin during the latter's vizierate, and supported him in deposing the Fatimid dynasty, which was achieved in 1171.
In the new Ayyubid regime, Qadi al-Fadil was an important figure, serving as Saladin's chief counsellor. He was left in charge of the Egyptian administration during Saladin's wars in the Levant. As a result, historians often attribute to him the title of vizier, which he never held. After Saladin's death in 1193, Qadi al-Fadil served Saladin's son al-Afdal, ruler of Damascus, before switching his allegiance to Saladin's second son, al-Aziz, ruler of Egypt. He retired after 1195, and died in 1200.
Qadi al-Fadil's reputation among contemporaries and later generations rests chiefly on his skill as an epistolary writer. His style was much admired and widely emulated by later generations. The corpus of his letters is also an important historical source for the period. In addition, he founded a madrasah in Cairo, and donated his large library to the institution.