The supremacy of the Abbasid Caliphate came to an end in 1258 with the Mongol invasion and destruction of Baghdad. Al-Musta'sim, the last reigning caliph and a direct descendant of the uncle of Muhammad, was executed by the Mongols by being wrapped in a carpet and trampled to death by horses.
For the next three centuries, the caliphate continued to rule from Cairo but in a greatly weakened state. The caliphs in Cairo served a purely religious and ceremonial role under the rule of the Mamluks.
The Ottomans claimed to be a continuation of the caliphate, which lasted from 1517 until 1924. It was first claimed by Sultan Murad I and continued through the line of Ottoman sultans over the next four centuries. When the Ottoman Empire was partitioned by the League of Nations following the empire's defeat in World War I, the caliphs lost all political influence. The last caliph, Abdulmecid II, retained his position until the secular reforms of Turkey under Mustafa Kemal in 1924.