The Abbasid Caliphate seized power from the Umayyad Caliphate in the 750 Abbasid Revolution, but the Umayyads retained control of Spain and Portugal, and the Abbasids inherited the Umayyad possessions in North Africa, the Middle East, and Khorasan. In its early years, it was a powerful caliphate that could fight against the Byzantine Empire, but the rise of the Persians and Turks from slave soldiers to warlords led to the caliphs losing power. The Buyids and Seljuk Empire were examples of slave dynasties that would act as "protectors" of the Caliph, and the empire was carved up into smaller states. In 1258, the caliphate's independence was destroyed when the Ilkhanate destroyed the city of Baghdad in the Fall of Baghdad, massacring 800,000-2,000,000 civilians and destroying much of the beautiful city. From then on, the caliph lived in Cairo under the rule of the Mamelukes, and they were eventually replaced by the Ottoman Empire's rulers as caliphs upon their conquest of Egypt in 1517.