From all the references to the Mahdi and his appearance in the sources it is obvious that people were awaiting the coming of the Mahdi from the early days of Islam and were actually counting the days for that to happen. They regarded the establishment of the legitimate government through his emergence a certainty.
This anticipation used to get intense during times of political turmoil and unfavorable social conditions. People expected that the emergence would take place imminently. On many occasions they would adhere to the false pretender or would regard some person to be truly the promised Mahdi. Those whom people thought were the promised Mahdi included the following:
(1) Muhammad bin Hanafiyya :
Since he had the name and patronymic of the Prophet there was a group that believed him to be the Mahdi. According to Tabari when Mukhtar bin Abu Ubayd Thaqafi wanted to revolt against the Umayyads and exact revenge from those who had murdered the grandson of the Prophet Hussein he ascribed Mahdiism to Muhammad bin Hanafiyya. And he claimed to be his envoy and his deputy and showed the letters he had brought with him to the people. 
Ibn Sa’d tells us that when people wanted to greet Ibn Hanafiyya they would address him thus: “Peace be to you O Mahdi!” And he would reply: “Yes I am the Mahdi and I shall guide you towards the straight path and prosperity. My name is the same as the name of the Prophet and my patronymic is also his patronymic. Whenever you want to greet me say: Peace be to you O Muhammad; peace be to you O Abu al-Qasim!'” 
This and other similar reports indicate that one of the signs of the appearance of the promised Mahdi was the combination of the Prophet’s name and patronymic for a person. This is the reason Ibn Hanafiyya made a reference to this fact for himself. However careful investigation of historical sources reveals that it was not Ibn Hanafiyya who made such claims for himself. It was others like Mukhtar who introduced him thus. On his part sometimes Ibn Hanafiyya kept silent on the matter confirming the attribution to him. This policy was probably followed with the hope that the murderers of Karbala would be avenged and the Islamic leadership would revert to its rightful holder.
This is supported by another report in which Ibn Hanafiyya tells the people: “Be aware that the rightful people have a government which will be established when God desires it. Anyone who witnesses it will be fortunate and anyone who predeceases it will enjoy the blessings of God in the hereafter.” 
Muhammad bin Hanafiyya in a sermon that he delivered in the presence of some seven thousand people said: “You have hastened in this matter. Yet among your descendants are people who with the help of the family of the Prophet will wage war against the enemies of God. The government of the family of the Prophet is not concealed from anyone. However its materialization will take time. I declare solemnly in the name of the One in whose hand is Muhammad’s life the rule will return to the Prophet’s family.” 
(2) Muhammad bin Abd Allah bin Hassan :
This was another descendant of the Prophet whom people accepted as the Mahdi. According to Abu al-Faraj when Muhammad bin Abd Allah was born the family of the Prophet rejoiced and quoted the Prophet saying: “The name of the Mahdi is Muhammad.” As such they were hopeful that Muhammad would be the promised Mahdi. They used to adore him. In the gatherings he was mentioned frequently and the Shi’ is used to give each other good news about his impending appearance.
In another place Abu al-Faraj reports an account which says that when Muhammad bin Abd Allah was born he was named Mahdi with the expectation that he was the Mahdi promised in the earlier sources. However the leaders of the Talibids used to call him nafs al-zakiyya and in accord with the divine decree he would be killed in Ihjar Zayt. One of the slaves of Abu Ja’far Mansur relates that he was told by Mansur to go and sit near the pulpit and listen to his lectures. Once he heard him say: “Do not entertain any doubt that I am the Mahdi and the reality is also thus.” The slave reported the incident to the Caliph who said: “By God Muhammad is telling falsehood. The truth is that the promised Mahdi is my son.” 
Salma bin Aslam composed lines about Muhammad bin Abd Allah in which he said: “That which is reported in the traditions will materialize when Muhammad bin Abd Allah appears among the people and takes charge of the affairs with his hands. Muhammad has a special ring which God has not given to anyone except him. There will be signs of piety and goodness in him. We hope that Muhammad will be the Imam through whose blessed existence the Qur’an will come to life again. Moreover through his existence Islam will be revived and reformed and the poor orphan children and needy families will again live in prosperity. He will fill the earth with justice and equity as it is filled with corruption. And our hopes and aspirations will be fulfilled.” 
Note : This time we will work on just ten parts of this useful book but as always accompany us for other parts of this book in future.
(52). Ta’ rikh Vol. 4 pp. 449-494; Ibn Athir Kamil al-tawarikh Vol. 1 p. 339 358.
(53). Tabaqat al-kubra Vol. 5 p. 66.
(54). Ibid. Vol. 7 p. 71.
(55). Ibid. Vol. 5 p. 80.
(56). Ibid. pp. 165 and 157.
(57). Ibid. p. 163.