During his seven-year Imamate Hasan al-Askari, the eleventh Imam, lived in taqiya. This was because the Abbasid Caliphs were afraid of the Shia, who had reached a considerable population at the time. The caliphs came to know that the leaders among the Shia believed that the eleventh Imam, according to numerous traditions cited by him and his forefathers, would have a son who was the promised Mahdi. The caliphs therefore decided to put an end to the Imamate. In these circumstances, Al-Mahdi gained the Imamate after the death of Hasan al-Askari in 874. In some narrations it is mentioned that Imam Al-Mahdi prayed Salat al-Janazah over his corpse, and then he went into minor occultation from the precaution of the Abbasid authorities.
Relationship with Shias
During the minor occultation, al-Mahdi connected with Shiites by his Four Deputies. When believers faced difficulty, they would write their concerns and send them to his deputy. The deputy would receive the decision of the Imam, endorse it with his seal and signature, and return it to the concerned parties. The deputies also collected zakat and khums on his behalf. For the Shia, the idea of consulting a hidden Imam was not something new, because the two prior Shia Imams had, on occasion, met with their followers from behind a curtain.
Four Deputies
Uthman ibn Sa'id al-Asadi : He was the first deputy appointed by 12th Imam who governed for one year;
Abu Jafar Muhammad ibn Uthman : He was the second deputy appointed by 12th Imam for forty two years;
Abu al-Qasim al-Husayn ibn Ruh al-Nawbakhti : He was the third deputy appointed by Al-Mahdi for twenty one years;
Abu al-Hasan Ali ibn Muhammad al-Samarri : He was the last deputy of 12th Imam for three years. Unlike his predecessors he had no appointed successor, and the Major Occultation began after his death. Six days before his death, he received a letter from Imam Hujjat-Allah al-Mahdi, in which he was notified that there would be no deputy after him. A translation of the letter is as follows:
"In the name of Allah, the all-Merciful, the especially-Merciful. O Ali Ibn Muhammad al-Samarri! May Allah increase the reward of your brothers concerning you ! Death will come to you within the next six days. So you complete your works and do not nominate any person after you. The sequence of special deputies will come to an end and the Major Occultation will commence with your demise. Now the reappearance will occur only with the permission of Allah, after a prolonged period and after the hearts of people are hardened. And such a period will emerge on my Shias when people will claim that they have met with me. Whoever makes such a claim before the advent of the Sufyani and the callfrom the sky is a liar, an impostor. And there is no strength nor power except from Allah, the High, the Great."
Following his death in 941, the Major Occultation began. Although during the Lesser or Minor Occultation the network of the Imam's deputies claimed to have the right to handle Shia communities' issues, this system was not continued during the Greater or Major Occultation.