After being on throne for sometime, the Abbaside Caliph, Mahdi realized that in the presence of the Family of the Holy Prophet (S) people would scarcely value his spiritual or temporal status. Thus he began to devise ways to arrest the Imam (a.s). In 144 A.H. he went to Hajj with a lot of ostentatious arrangements. The Holy Imam had also arrived for Hajj. In the very days of Hajj, Mahdi dispatched a slave of his to the Imam and summoned him to his presence. When the slave arrived he found Imam (a.s) engrossed in the worship of Allah. When he concluded his prayers, the slave conveyed the caliph’s message and waited for the Imam’s reply. The Imam (a.s) said, “Tell Mahdi, that right now I am in the service of such a glorious Emperor Who is the Creator and Master of all the worlds. I don’t have time to meet him (Mahdi). I will see after completing the Hajj.” Mahdi found this reply very distasteful. Finding this a good opportunity, his officials and agents began to tell him that Musa Ibn Ja’far intended to revolt against him. “He has raised a battalion of his Shias to fight you. He is collecting Khums and Zakat funds to use in war.” Hearing all this, Mahdi was further infuriated. After Hajj again he summoned the Holy Imam. He arrived. He accorded no honor to the Holy Imam and did not even invite him to be seated.
The Imam did not like these bad manners, and without his permission he seated himself next to him. Mahdi said tauntingly, “I had summoned you before but you did not oblige. Are such the manners of the family of the Prophet?” The Imam replied with utmost daring, “For me the command of Allah had more importance than your instructions. This is the sanctuary of Allah. Herein the ruler and subjects, the rich and the poor, all are same.” He said, “I have heard that you are raising an army against me?” “No”, said the Imam, “Whoever has conveyed to you thus is a liar and an enemy of us, Ahl ul-Bayt. We Ahl ul-Bayt never like mischief and turmoil.” He said, “Is my obedience not incumbent on you?” “Not at all!” replied the Imam, “Allah has made our obedience incumbent on all as we are Ulil Amr.” Mahdi said, “I desire to keep you at Baghdad with me, so that people of that region may also benefit from your knowledge.” Imam (a.s) said, “It would be unbearable for me to leave the Holy House.” But Mahdi did not relent and at last he took the Imam (a.s) along with him to Baghdad and put him in prison.
Reference :Akhlaq al-A’imma, Morals & Manners of the Holy Imams