From early in his reign, the Fatimid Caliph-Imam Al-Mustansir Billah had publicly named his elder son Nizar as his heir to be the next Fatimid Caliph-Imam. Dai Hassan-i Sabbah, who had studied and accepted Ismailism in Fatimid Egypt, had been made aware of this fact personally by al-Mustansir. After Al-Mustansir died in 1094, Al-Afdal Shahanshah, the all-powerful Armenian Vizier and Commander of the Armies, wanted to assert, like his father before him, dictatorial rule over the Fatimid State. Al-Afdal engineered a palace coup, placing his brother-in-law, the much younger and dependent Al-Musta'li, on the Fatimid throne. Al-Afdal claimed that Al-Mustansir had made a deathbed decree in favour of Musta'li and thus got the Ismaili leaders of the Fatimid Court and Fatimid Dawa in Cairo, the capital city of the Fatimids, to endorse Musta'li, which they did, realizing that the army was behind the palace coup.