When Imam Husayn left Madina for Makkah along with the members of his family, his brother Muhammad bin Hanafiya remained in Madina. The mother of Muhammad, the son of Ali, belonged to a tribe named Bani Hanafiya and on this account he was called Muhammad bin Hanafiya. He was a magnanimous, brave and pious person. Although Kaisaniya sect considered him to be an Imam he himself believed in the imamate of his brother Imam Hasan after his father Imam Ali, and thereafter in the imamate of his second brother Imam Husayn and then in the imamate of his nephew Ali bin Husayn. He was a distinguished person among the Ahlul Bayt and showed great valor in the battles fought by Imam Ali the Commander of the Faithful. 
When Imam Husayn left Madina for Makkah he wrote a testament for his brother Muhammad bin Hanafiya. It has been narrated by Ibn Tawus. In this testament the Imam mentioned the motive for his rising and clarified the policy which he intended to pursue in all circumstances. He also referred to the false motives which instigate a man and make him fight to satisfy his carnal desires and stated that the godly persons are free from such motives. The testament reads as follows:
In the name of Allah, the Beneficent, the Merciful.
"This is the testament of Husayn bin Ali bin Abi Talib written by him for his brother Muhammad, known as Ibn Hanafiya. Indeed Husayn testifies that there is no god except Allah and no being other than Him is fit to be worshipped and He has no partner. He also testifies that Muhammad is Allah's servant and messenger, who has brought truth from Him, and that Paradise and Hell do exist and the Day of Judgment is bound to come and there is no doubt about it, and on that day, Allah will bring the dead to life".
What the Imam said consists of the very doctrines which it is necessary for every Muslim to hold, and one who does not hold them cannot be a Muslim. Apparently the Imam meant to say that these very principles were in danger and, if the matters were allowed to continue in that manner, it was possible that the regime of the time might not refrain even from attacking these Principles of Faith. In fact the real motive for the Imam's rising was the protection of these very principles on which other religious and social tenets of Islam are based.
The Imam continued: "This movement of mine is not on account of stubbornness, rebellion, worldly passions or instigation by Satan. It is also not my object to create trouble or to oppress anyone. The only thing which invites me to this great movement is that I should reform the affairs of the followers of my grandfather, eradicate corruption, undertake enjoining to do good and restraining from evil and follow the tradition of my grandfather, the Prophet of Allah and my father, Ali". This testament does not mention the formalities that usually form part of the last will made nowadays. On the other hand the Imam wished to clarify his motive. He wanted to tell the people that his movement was not an ordinary one based on human passions and worldly desires. He, therefore, says: I am not going out for merry-making and amusement or to create mischief. I am also not perusing the path of oppression". He adds: "I have come out to reform the followers of my grandfather". These words show that in the year 60 A.H. the Muslim ummah was faced with a dreadful social and religious crisis, which could not be overcome with a severe and bloody revolution. It was a danger that could be faced only by a leader like Husayn bin Ali, whose infallibility has been testified by the Holy Qur'an in the verse of Purification of Surah al-Ahzab (33:33). It was a peril that could not be dealt with by means of speeches and religious sermons. He added: "If the people respond to my call, and accept truth from me, well and good; and if they do not accept it, I shall observe patience and am not afraid of unpleasant events, hardships, and sufferings". By saying that he would observe patience, the Imam did not mean to say that he would sit with folded hands so that Yazid might do whatever he liked. On the contrary he used this word in its correct sense, which is suited to the position of an Imam, and is the basis of faith and godliness. In other words he said: "Even if I am alone I shall pursue this path till Allah decides justly between me and these people, and He is the most Wise and the most Powerful of the judges".
Thereafter he wrote: "O my brother! This is my testament for you. I do not seek assistance from anyone except Allah. I depend on Him alone and have to return to him".
 It is said that the Roman Emperor sent two herculean athletes to Muawiya to measure their strength with the Muslim athletes. One of them was tall and corpulent and the other was powerful with a strong grip. Muawiya said to Amr bin As: "We have got a match for the tall man in the person of Qays bin sad bin Ubada, but as regards the other man you should think over it as to who can measure his strength with him and defeat him". Amr said: "I have two persons in view but you are inimical towards both of them. One of them is Muhammad bin Hanafiya and the other is Abdullah bin Zubayr". Muawiya said: "You should summon him who is nearer to us at present. Amr asked Muhammad bin Hanafiya to meet the challenge. Muawiya took his place in the general assembly and the dignitaries of the State also attended. The powerful person was the first to enter the field and came face to face with Muhammad. Muhammad said to him: "Either you should sit down and let me hold your hand so that I may pull you off from your seat, or I may sit down and you may lift me from my place. Now let me know whether you are going to sit down or I should do so?" The Roman said: "You may sit down. Muhammad sat down and let the Roman hold his hand. In spite of his best efforts, however, the Roman could not move Muhammad from his place, and acknowledged his weakness. Then Muhammad stood up and the Roman sat down and let Muhammad hold his hand. Muhammad immediately lifted him from his place with one jerk, held him in the air, and then threw him on the ground. Those present applauded him for his strength and Muawiya too was very happy. Now the second Roman champion who was tall statured entered the field to compete. Qays bin Sād who was present went in a corner, took off his underwear and gave it to the Roman to wear. When the Roman put it on it reached his breast and also trailed along behind his feet. Thereupon, he felt ashamed and sat down. The elder amongst the Ansar were very much annoyed on Qays having taken off his underwear in such a formal meeting and rebuked him. He, however, composed some verses in which he apologized for his conduct.