He was born into a scholarly family in 762 AH in the city of 'Ayntāb. He studied history, adab, and Islamic religious sciences, and was fluent in Turkish. There is some evidence that he also knew at least some Persian. In 788 AH he travelled to Jerusalem, where he met the Hanafi shaykh al-Sayrāmī, who was the head of the newly established Zāhiriyah madrasah and khānqah Al-Sayrami invited al-'Ayni to accompany him home to Cairo, where he became one of the Sufis of the Zāhiriyah. This was a step upward for the young al-'Ayni, as it represented entry into "an institution with ties to the highest level of the ruling elite." He established a good reputation and initially met with favor. However, after al-Sayrāmī died in 790 AH, al-'Ayni became involved in a personality conflict with the amirJārkas al-Khalīlī, who tried to run him out of Cairo. Al-'Ayni later described al-Khalīlī as arrogant and dictatorial – "a man pleased by his own opinion." He was saved from expulsion by one of his teachers, Siraj al-Din al-Bulqini, but prudently decided to leave for a time anyway. From Cairo he went to teach inDamascus, where he was appointed muhtasib by the amir, and returned to Cairo some time before 800 AH Once back in Cairo, al-'Ayni strengthened his social and political position by associating with several amirs, making the Hajj with the amir Tamarbughā al-Mashtūb. He also had the patronage of the powerful amir Jakm min 'Awd, who was dawadār to the SultanBarqūq. After the death of Barqūq, al-'Ayni became the muhtasib of Cairo, displacing the scholar al-Maqrīzī. According to al-Maqrīzī it was Jakm who obtained the post for al-'Ayni; however, the historian Ibn Taghribīrdī states that it was a cooperative effort by Jakm and two other amirs, Qalamtāy al-'Uthmānī and Taghribīrdī al-Qurdamī. In any case, this was the beginning of a lifelong feud between the two ulama : "From that day on, there was hostility between the two men until they both died." Al-'Ayni and al-Maqrīzī succeeded each other as muhtasib of Cairo several times over the next few years, probably a reflection of the power struggle between Jakm min 'Awd and al-Maqrīzī's patron, Yashbak al-Sha'bānī. Neither held the post for very long. In the reign of al-Nasir Faraj, Barqūq's son and successor, al-'Ayni was appointed to the "lucrative and prestigious" post of nāzir al-ahbas He would be dismissed from and reappointed to this post several times, finally securing it for good in the reign of the Sultan Mu'ayyad Shaykh and keeping it until he was ninety-one. Al-'Ayni's prestige grew as he aged. Mu'ayyad Shaykh named him ambassador to the Qaramanids in 823 AH Later in life he would be called upon to lecture on learned topics before the Sultan, sometimes reading history aloud in Arabic and explaining it in Turkish for the Sultan's benefit. The Sultanal-Ashraf Barsbāy is reported to have said "Islam is known only through him" and law lā al-'ayntābi la-kāna fī islāmina shay', "If not for al-'Ayntabi there would be something suspect in our Islam." Barsbāy sometimes sent al-'Ayni as his representative to greet foreign dignitaries, apparently because of his fluency in several languages. Barsbāy often turned to al-'Ayni for advice on legal matters, and named him chief Hanafi qadi in 829 AH He was dismissed from this post after three years; by his own report, both he and the chief Shafi'iqadi, Ibn Hajar al-Asqalani, were dismissed at the same time because their constant feuding was distracting them from their duties; though he adds that this was a calumny spread by his enemies at court. He was later reappointed. In the reign of Barsbāy's successor, al-Aziz Jaqmaq, al-'Ayni was dismissed as chief Hanafi qadi again. He withdrew from court and concentrated on his scholarly writing. In 853 AH he was dismissed as nāzir al-ahbas, probably because of failing memory. He died in 855 AH at the age of ninety-three, having outlived all his children, and was buried in his own madrasah in Cairo.
Works
Umdat al-Qari
al-Binaya Sharh al-Hidaya
al-Sayf al-Muhammad fī Sīrat al-Malik al-Mu'ayyad
'Iqd al-Jūman fī Ta'rikh Ahl al-Zamán
ar-Rad al-Waafir
Nukhab al-Afkar fi Tahqiq Mabani al-Akhbar fi Sharh Ma`ani al-Aathar