Saladin's Ayyubid dynasty controlled many lands. Libya, the Hejaz, Yemen, Sudan, Egypt, and Syria were all under Saladin's control. Saladin also took control of many castles, and he took control of Jerusalem after the Battle of Hattin in 1187. (Jerusalem had been part of the Roman Catholic Kingdom of Jerusalem from the time of the First Crusade. Saladin took back Jerusalem for the Muslims.) Saladin died in 1193. The Ayyubid dynasty ended in 1250, when the Mamluks took control of Egypt and the Mongols attacked the Ayyubids in Syria. With the end of the Ayyubids' government in Egypt and Syria, Kurdish power there ended. (Some of the Ayyubid dynasty continued to control Hasankeyf into the 16th century.) Kurds continued to live in many lands that the Ayyubids had controlled. From this time, many Kurds lived in the Kurdish quarter of Damascus. (They spoke Kurdish there into the 20th century.)