Abul-Hasan Ali ibn Muhammad, who is known by the titles al-Hadi (the guided) and an-Naqi (the distinguished), was born in 212/827 or 214/829 in Medina. His mother was a Moroccan slave called Samana. He was seven years old when his father died. Once again the Shiis were faced with the problem of the child Imam.
During the remaining years of the Caliphate of Mutasim and the five year Caliphate of Wathiq, al-Hadi and the Shiis were relatively free and unmolested. All this was to change, however, with the Caliphate of Mutawakkil which began in 232/847. During this reign, both Shiis and Mutazilis came under an intense persecution.
In 233/848 Mutawakkil summoned al-Hadi to Samara, the new Abbasid capital north of Baghdad. Although received hospitably and given a house in which to live, al-Hadi was in reality a prisoner of the Caliph, The quarter of the city where al-Hadi lived was known as al-Askar since it was chiefly occupied by the army (askar) and, therefore, al-Hadi and his son Hasan are both referred to as Askari or together as Askariyayn (the two Askaris). Al-Hadi lived in Samarra for twenty years, always under the observation of the Caliphs spies. It is reported that at least once Mutawakkil attempted to kill al-Hadi but was frustrated by a miracle. Al-Hadi continued to live in Samarra after the death of Mutawakkil in 247/861 and during the brief reign of Muntasir and the four-year reign of Mustain until his death in 254/868 during the Caliphate of Mutazz. Real power was, by this time, in the hands of the Turkish Generals of the Caliphs and so it is difficult to see what advantage there would have been to the Caliph in poisoning the Imam as most Shii histories claim. Shaykh al-Mufid, among the early Shii writers, does not state that the Imam was poisoned.
Ali al-Hadi and his son Hasan al-Askari are buried in the twin shrines called Askariyayn in Samarra. The first substantial building over this site was constructed by Nasirud-Dawla, the Hamdanid ruler of Mosul in 333/944. The building was enlarged and ornamentation added by the Buyids and Safavids and the dome was gilded by Nasirud-Din Shah Qajar in about 1868
Bibliography:
See M. Momen, An Introduction to Shii Islam (1985).