Service under the Fatimids in Qadi al-Fadil was born on 2 April 1135 at
Ascalon. His father, known as al-Qadi al-Ashraf (d. 1149/50), was serving as judge () and financial comptroller () there. The exact significance of the
epithet 'al-Baysani' is unclear: one version holds that the family hailed from
Baysan, while another that it hailed from Ascalon, but that Qadi al-Ashraf had previously served as at Baysan. Qadi al-Fadil received his basic education at his home town, before moving to
Cairo in , where, at the initiative of his father, he entered the
chancery () of the
Fatimid Caliphate as a trainee. The long-serving head of the chancery,
Ibn Khallal, became his patron during his subsequent career. This training included administrative practice and especially the arts of epistolary and secretarial writing. Despite his own title of , however, it is unclear whether Qadi al-Fadil also received judicial education at any point. The title was common for officials in the Fatimid administration as a honorific, and under the
Isma'ili Shi'a Fatimid regime, there were no
Sunni schools in Cairo where he, as a Sunni, might have acquired the necessary training. According to the 13th-century encyclopaedist
Yaqut al-Hamawi, at this time Qadi al-Fadil's father fell into disgrace because he failed to inform Cairo of the release of an important hostage by the governor of Ascalon. His property was confiscated, and he died, destitute, soon after. According to this account, Qadi al-Fadil had to interrupt his apprenticeship and go on foot to
Alexandria, where by 1153 he had become secretary to the of
Alexandria, Ibn Hadid. His small salary of three
gold dinars per month did not suffice to care for his mother, brother and sister back in Ascalon, but following the
fall of Ascalon to the
Crusaders in the same year, the rest of his family moved to Egypt. Alexandria was the seat of a
Maliki law school, but it is again unknown if he attended it. The only available information comes from the later writer
al-Mundhiri, who reports that during his stay in Alexandria, Qadi al-Fadil studied under the two eminent
jurists Abu Tahir al-Silafi and
Ibn Awf. In this post he distinguished himself due to the artful language of his dispatches, and was called to Cairo by the
vizier Ruzzik ibn Tala'i (vizierate: 1161–1163) and appointed head of the army bureau (). When Ruzzik was deposed by
Shawar, Qadi al-Fadil became the secretary to Shawar's son, Kamil. During Shawar's conflicts with
Dirgham, he sided with the former, and was even imprisoned for a time along with Kamil in August 1163, when Dirgham seized power. After the final victory of Shawar in May 1164, Qadi al-Fadil was released and given many honours, including the epithet of (), by which he is known.
Switch of allegiance and the fall of the Fatimid Caliphate As a partisan of Shawar, Qadi al-Fadil had originally opposed
Shirkuh, the
Türk general who had invaded Egypt on behalf of his Syrian King,
Nur al-Din. Qadi al-Fadil's support extended to supporting Shawar's decision to
turn to the Crusaders for aid against the Syrian troops. Nevertheless, within a short time, he managed to gain the friendship of Shirkuh and remained in service in the chancery under both him and his nephew and successor,
Saladin. The sources give different accounts of the background of these events. Modern historians generally consider the truthfulness of these reports doubtful, as they are at pains to exculpate Qadi al-Fadil for his sudden change of allegiance from the Fatimids to the
Ayyubids. This change is not difficult to understand. Although a high official of the Fatimid state, Qadi al-Fadil was likely a devoted Sunni, as were most of the civilian bureaucracy at the time. His loyalty to the Fatimid dynasty and the Isma'ili sect was therefore dubious at best, and it was not difficult for him to transfer his allegiance to the Sunni Ayyubids. The Fatimid regime itself was already in decline, challenged by over-mighty viziers who had reduced the
caliphs to puppets. The official sect of Isma'ilism had lost its appeal and was weakened by disputes and schisms, and the dynasty's legitimacy was increasingly challenged by a Sunni resurgence that was partly sponsored by the Fatimids' own viziers. In 1167/8, Qadi al-Fadil became the new head of the chancery, replacing his old patron Ibn Khallal. When the latter died on 4 March 1171, he became the secretary to Saladin. From 1170 on, Saladin gradually moved to dismantle the Fatimid regime and replace Isma'ilism with Sunni Islam. The 14th-century Egyptian historian
al-Maqrizi ascribes to Saladin and Qadi al-Fadil jointly the common cause of deposing the Fatimid dynasty, and Saladin himself is said to have remarked "I took Egypt not by force of arms but by the pen of Qadi al-Fadil". When Saladin deposed the Fatimid regime outright following the death of caliph
al-Adid in September 1171, Qadi al-Fadil played a leading role in carrying out the subsequent changes in the military and fiscal administration of Egypt. Qadi al-Fadil's role in the suppression of a
supposed pro-Fatimid conspiracy in April 1174 is unclear. The aftermath included the execution of a number of former Fatimid officials, most notably the poet
Umara al-Yamani. Qadi al-Fadil's account of the extent of the conspiracy is at odds with the limited reprisals, and the affair was likely a settling of old rivalries within the former Fatimid administrative elites.
Service under Saladin Imad al-Din al-Isfahani, a friend and collaborator who entered Saladin's service through Qadi al-Din's intercession, writes of him that he was the "principal driving force behind the affairs of Saladin's regime", but his exact duties are unclear. Although often called Saladin's
vizier, Qadi al-Fadil never held that title. He was nevertheless the closest counsellor and chief secretary of the Ayyubid ruler until Saladin's death. He accompanied Saladin in his campaigns in Syria, but in the sources, he is chiefly associated with Egypt, where most of his career took place. Thus in 1188/89 Saladin renewed Qadi al-Fadil's brief to supervise all affairs of Egypt, while in 1190/91 he was tasked with equipping a fleet to assist Saladin in his
Siege of Acre. At the same time, during Saladin's absence in the wars against the Crusaders, the government of Egypt was formally left to other members of the Ayyubid clan. Qadi al-Fadil was critical of Saladin's brother,
al-Adil. After he left Egypt, Qadi al-Fadil successfully lobbied for al-Adil's replacement by his friend, Saladin's nephew
Taqi al-Din. For unknown reasons, Qadi al-Fadil was not present at Saladin's greatest victory at the
Battle of Hattin (1187), nor in the subsequent recapture of
Jerusalem. In Christian sources, Qadi al-Fadil is blamed for the anti- purge of the early years of Saladin's rule, which saw Christians evicted and banned from holding posts in the public fiscal administration. At the same time, however, Qadi al-Fadl sponsored a number of Jewish physicians, among them the celebrated philosopher
Maimonides, whom he defended from charges of
apostasy, and who dedicated his book
On Poisons and Antidotes to his patron. From his prominent post, Qadi al-Fadil became a wealthy man: he reportedly received an annual salary of 50,000 gold dinars, and became a successful merchant, trading with India and North Africa. Outside the
city walls of Cairo, a change of the course of the Nile had exposed large tracts of land that were exceedingly fertile. Qadi al-Fadil bought much of it, and converted these estates into an orchard that supplied the capital with fruit.
Final years and death After Saladin's death at
Damascus in March 1193, Qadi al-Fadil initially served his oldest son
al-Afdal, ruler of Damascus. Due to al-Afdal's erratic leadership, he quickly returned to Egypt, where he entered the service of
al-Aziz, Saladin's second son, who had seized power there. When the two brothers came into conflict, Qadi al-Fadil managed to mediate a peace between them in 1195. After this he retired, and died on 26 January 1200. He was buried in the
Qarafa cemetery in Cairo. A mausoleum was erected on top of his grave. Qadi al-Fadil's surviving family is mostly obscure. From his many sons, only
al-Qadi al-Ashraf Ahmad Abu'l-Abbas is notable, who served the Ayyubid rulers of Egypt until his death in 1245/46. ==Writings and patronage of learning==