The Ayyubid dynasty (Arabic: ۧÙŰŁÙÙŰšÙÙÙ, romanized: al-AyyĆ«bÄ«yĆ«n), also known as the Ayyubid Sultanate, was the founding dynasty of the medieval Sultanate of Egypt established by Saladin in 1171, following his abolition of the Fatimid Caliphate of Egypt. A Sunni Muslim of Kurdish origin, Saladin had originally served the Zengid ruler Nur al-Din, leading the latter's army against the Crusaders in Fatimid Egypt, where he was made vizier. Following the death of his Zengid suzerain Nur al-Din in 1174, Saladin was proclaimed as the first Sultan of Egypt by the Abbasid Caliphate, and rapidly expanded the new sultanate beyond Egypt to encompass most of Syria, in addition to Hijaz, Yemen, northern Nubia, Tripolitania and Upper Mesopotamia. Saladin's military campaigns set the general borders and sphere of influence of the sultanate of Egypt for the almost 350 years of its existence. Most of the Crusader states fell to Saladin after his victory at the Battle of Hattin in 1187, but the Crusaders reconquered the Syrian coastlands in the 1190s.
After Saladin's death in 1193, his sons contested control of the sultanate, but Saladin's brother al-Adil ultimately became sultan in 1200. All of the later Ayyubid sultans of Egypt were his descendants. In the 1230s, the emirs of Syria attempted to assert their independence from Egypt and the Ayyubid realm remained divided until Sultan as-Salih Ayyub restored its unity by subduing most of Syria, except Aleppo, by 1247. By then, local Muslim dynasties had driven out the Ayyubids from Yemen, the Hejaz, and parts of Mesopotamia. After his death in 1249, as-Salih Ayyub was succeeded in Egypt by his son al-Mu'azzam Turanshah. However, the latter was soon overthrown by his Mamluk generals who had repelled a Crusader invasion of the Nile Delta. This effectively ended Ayyubid power in Egypt. Attempts by the emirs of Syria, led by an-Nasir Yusuf of Aleppo, to wrest back Egypt failed. In 1260, the Mongols sacked Aleppo and conquered the Ayyubids' remaining territories soon after. The Mamluks, who expelled the Mongols, maintained the Ayyubid principality of Hama until deposing its last ruler in 1341.