 The Ayyubids had owed their allegiance to the Abbasid Caliphate, but the latter was destroyed when the Mongols sacked the Abbasid capital Baghdad in 1258 and killed Caliph al-Musta'sim.Three years later, Baybars reestablished the institution of the caliphate by making a member of the Abbasid family, al-Mustansir, caliph, who in turn confirmed Baybars as sultan.In addition, the caliph recognized the sultan's authority over Egypt, Syria, Mesopotamia, Diyarbakir, the Hejaz and Yemen and any territory conquered from the Crusaders or Mongols.