Before long, many developments had combined to weaken the Abbasids from within. As their rule was racked by rebellions and secessionist movements, as well as doctrinal and intellectual disputes, their power, prestige, and influence declined markedly after 945. First, the powerful Buyid family of northwestern Iran established itself as the “protector” of the Abbasid caliph from 945 to 1055, essentially turning the caliphal clan into mere figureheads. The Turkish Saljuqs similarly dominated Baghdad from 1055 until the middle of the twelfth century. The Abbasids, or what remained of them, were finally overrun in 1258 by the invading Mongols. By then, the Abbasid Empire had already started coming apart. Ruling clans within the different territories had begun to exercise considerable local autonomy. A revived Umayyad dynasty ruled Spain. Abbasid hegemony was also challenged in North Africa, where a Shi‘ite group eventually conquered Egypt in 969, established the Fatimid dynasty, and built a new capital city called Cairo (al Qahirah, the conqueror) along the Nile. The conquerors of Egypt were soon caught up by what may be called the “Pharaoh syndrome,” which appears to have plagued many of Egypt’s rulers, both ancient and contemporary. Their court was replete with splendor and ritual, the center of a city victorious and grand. Meanwhile, the first wave of Crusaders were sent from Europe to Jerusalem to protect the Christian Byzantine emperor in Constantinople from the menacing Muslims, further weakening the Abbasids and even the Fatimids. Here a Kurdish general by the name of Salah al-Din (Saladin) distinguished himself in bravery and eventually became the sultan of Egypt after the death of the last Fatimid caliph in 1171. Saladin’s control of Egypt was initially in the name of the Abbasid caliph. In 1175, Baghdad recognized his sultanate over Egypt, Yemen, Palestine, and Syria, areas where Saladin was already in de facto control. On October 2, 1178, he also occupied Jerusalem and wrested its control from the Crusaders. But the Ayyubid dynasty that he established did not last long, having to rely on ex-slave soldiers, called Mamluks, to defend itself against the invading Mongols. The Mongol conquest had started in earnest in Asia Minor in 1219, overrunning Iran and in turn establishing the Ilkhanid dynasty there from 1256 to 1336. The Mamluks, meanwhile, established a dynasty of their own in Egypt in 1250, not to be overthrown until the advent of the Ottomans in 1517 (Source: Political History of Middle East).