Al-Nasir Salah al-Din Yusuf ibn Ayyub, better known simply as Salah ad-Din or Saladin (), was a Sunni Muslim Kurd who became the first sultan of both Egypt and Syria, and was the founder of the Ayyubid dynasty. He was originally sent to Fatimid Egypt in 1164 alongside his uncle Shirkuh, a general of the Zengid army, on the orders of their lord Nur ad-Din to help restore Shawar as vizier of the teenage Fatimid caliph al-Adid. A power struggle ensued between Shirkuh and Shawar after the latter was reinstated. Saladin, meanwhile, climbed the ranks of the Fatimid government by virtue of his military successes against Crusader assaults against its territory and his personal closeness to al-Adid. After Shawar was assassinated and Shirkuh died in 1169, al-Adid appointed Saladin vizier, a rare nomination of a Sunni Muslim to such an important position in the Shia caliphate. During his tenure as vizier, Saladin began to undermine the Fatimid establishment and, following al-Adid's death in 1171, he abolished the Fatimid Caliphate and realigned the country's allegiance with the Sunni, Baghdad-based Abbasid caliphate.