Abu al-Hasan Ali ibn Muhammad al-Samarri

Abu al-Hasan Ali ibn Muhammad al-Samarri (أَبُو ٱلْحَسَن عَلِيّ ٱبْن مُحَمَّد ٱلسَّمَّرِيّ, ʾAbū al-Ḥasan ʿAlīy ibn Muḥammad as-Sammarīy) was the last of the Four Deputies, who are believed by the Twelvers to have successively represented their Hidden Imam, Muhammad al-Mahdi, during his Minor Occultation (874–941 CE). Al-Samarri in this role succeeded Abu al-Qasim al-Husayn ibn Ruh al-Nawbakhti in 937.

Al-Samarri is said to have received a letter from Muhammad al-Mahdi shortly before his death in 941 CE. The letter predicted the death of al-Samarri in six days and announced the beginning of the complete occultation, later called the Major Occultation, which continues to this day. The letter, ascribed to Muhammad al-Mahdi, added that the complete occultation would continue until God granted him permission to manifest himself again in a time when the earth would be filled with tyranny.

Historical background
Until their deaths, the tenth and eleventh Shia Imams (Ali al-Hadi and Hasan al-Askari, respectively) were held in the garrison town of Samarra under close surveillance (or house arrest) by the Abbasids, who are often responsible in Shia sources for poisoning the two Imams. The two Imams witnessed the deterioration of the Abbasid caliphate, as the imperial authority rapidly transitioned into the hands of the Turks, particularly after al-Mutawakkil.

Contemporary to the tenth Imam, the Abbasid al-Mutawakkil violently prosecuted the Shia, partly due to a renewed Zaydi opposition. The restrictive policies of al-Mutawakkil towards the tenth Imam were later adopted by his son, al-Mu'tamid, who is reported to have kept the eleventh Imam under house arrest without any visitors. Instead, al-Askari is known to have primarily communicated with his followers through a network of representatives. Among them was Uthman ibn Sa'id, who is said to have disguised himself as a seller of cooking fat to avoid the Abbasid agents, hence his nickname al-Samman. Tabatabai suggests that these restrictions were placed on al-Askari because the caliphate had come to know about traditions among the Shia elite, predicting that the eleventh Imam would father the eschatological Mahdi.

Immediately after the death of al-Askari in 260 (874), Uthman ibn Sa'id claimed that the eleventh Imam had a young son, named Muhammad, who had entered a state of occultation (ghayba) due to the Abbasid threat to his life. As the special agent of al-Askari, Uthman also claimed that he had been appointed to represent the son of the eleventh Imam. Twelver sources detail that Muhammad al-Mahdi made his only public appearance to lead the funeral prayer for his father instead of his uncle, Ja'far.

Thus began a period of about seventy years, later termed the Minor Occultation (, 260-329 AH, 874–940 CE), during which it is believed that four successive agents acted as intermediaries between the Hidden Imam and his followers. These four agents are collectively known as the Four Deputies (al-nuwwab al-arba'). An agent (wakil) was also variously called deputy (na'ib), emissary (safir), and gate (bab).

Uthman was later succeeded by his son, Abu Ja'far Muhammad, who was followed in 917 CE by the third agent, Ibn Ruh al-Nawbakhti, who served until his death in 937 CE.

Life
Not much is known about the early life of al-Samarri. His surname is derived from al-Sammar or al-Saymar, located near Basra, where the relatives of al-Sammari used to live. His family was known for its service to the Shia community, and some of his relatives were (local) agents of the Hidden Imam, such as Ali ibn Muhammad ibn Ziyad, who was earlier a representative of the tenth and eleventh Imams. Al-Sammari was also a brother-in-law of the Abbasid vizier Ja'far ibn Muhammad. According to Hussain, all these suggest that al-Samarri must have faced little resistance from the Shia community later when he succeeded Ibn Ruh as the fourth agent of the Hidden Imam.

Tenure as an agent of al-Mahdi
Al-Samarri succeeded Ibn Ruh as the fourth agent in 326 (937) and held the office for about three years. In contrast to the third agent, less is known about the other three agents, including al-Samarri. While the details of his activities are unknown, a report cited by Ibn Babawayh cites a report to the effect that the (local) agents recognized and cooperated with al-Samarri.

His death and the Major Occultation
Al-Samarri is said to have received a letter from al-Mahdi shortly before his death in 329 (941). The letter predicted the death of the fourth agent in six days and announced the beginning of the complete (tamma) occultation, later called the Major Occultation. The letter, ascribed to al-Mahdi, added that the complete occultation would continue until God granted him permission to manifest himself again in a time when the earth would be filled with tyranny. The letter also emphasized that anyone claiming to be the deputy of the Imam henceforth had to be considered an imposter. Sachedina is of the view that the Shia community lacked a notable figure to replace the fourth agent after his death.

This and similar letters to the four agents and other Shia figures are said to have had the same handwriting, suggesting that they were written by the Hidden Imam. Ibn Babawayh and Tusi both quote this final letter, parts of which are presented below:

"O' Ali b. Muhammad al-Samarri, may God reward your brethren in your death, which is going to take place in six days' time. So take care of your affairs and do not appoint anyone in your place, since the complete occultation has taken place. I will not appear until God permits me to do so (may His name be exalted) and that will be after a long time and after the hearts become hard and the earth is filled with wickedness. In the near future there will be those among my followers who will claim to have seen me. Beware, those who claim this before the rise of al-Sufyani and the [hearing of the] voice from the sky are liars."