Citadel of Aleppo, Syria (built by Saladin)
When the First Crusade defeated the Fatimid Caliphs and captured Jerusalem in 1099 AD, people in Egypt and Syria gradually decided that the Fatimids were too weak to rule anymore. One of their generals, Saladin (Salah ad-Din ibn Ayyub in Arabic), took over control from the Fatimids and founded the Ayyubid dynasty (ai-YOU-bid).
Saladin was Kurdish, from Tikrit in northern Iraq. He came to Egypt in 1168 as an assistant to his uncle, who was a general and then became the vizier of the last Fatimid caliph. After Saladin's uncle died the next year, Saladin took power for himself. In 1173 Saladin's brother Turanshah conquered Yemen, in the Arabian Peninsula, which gave Saladin control of trade from India through the Red Sea. He was a very successful general who followed the Mamluk generals Zangi and Nureddin in taking back most of the territory that had been lost to the First Crusade. He won back Jerusalem in 1187 AD.
Tomb of Saladin
Saladin was a Sunni Moslem, so he brought back Sunni worship to Egypt and Syria, even though the Fatimids had been Shiites. He opened a series of madrasas, or schools, which helped to bring Sunni faith to the people, and also spread other learning from Iran to Egypt and Syria. This also brought the Ayyubids closer to the Abbasid caliphs in Baghdad. When Saladin died in 1193 AD, he was buried in Damascus, next to the great Umayyad Mosque there.
After his death, Saladin's sons and relatives broke up his empire so they could each have their own small kingdom to rule. There were small kingdoms at Damascus, Aleppo, Hims, Hamat, and Diyar Bakr. But the Ayyubid sultans of Egypt were the richest and so they mostly controlled all the smaller kingdoms. Scholars and preachers like Maimonides and Francis of Assisi visited or lived in Egypt, the richest city of the rich Ayyubid sultanate. When Pope Honorius attacked Egypt in the Fifth Crusade, the Ayyubids fought them off. In the Sixth Crusade, the Crusaders fought as mercenaries for the Ayyubids against the Mamluks in exchange for control over Jerusalem.
The later Ayyubids bought Turkish and Mongol slaves to be their army rather than fighting themselves. These slaves were called the Mamluks. But little by little the Ayyubid sultans had less and less power and the Mamluks got more and more power. Finally in 1250 AD the Mamluks took over Egypt entirely. By 1260 most of the other Ayyubid kingdoms were also taken over by the Mamluks.