 He was educated in the Abbasid capital of Baghdad and taught in the Ayyubid-held cities of Hama, Cairo and Aleppo before being appointed the "qadi" (chief Islamic judge) of Hama.He belonged to the Shafi'i school of jurisprudence ("fiqh").In 1243 he was sent as an envoy to Baghdad by Hama's Ayyubid ruler al-Muzaffar Mahmud.