The holy Imam gained the imamate after the death of this noble father , through the devine command and through the decree of the previous imams,During the seven yearsof his imamate ,due to untold restrictions placed upon him by the king, he lived hiding and dissimulation. He did not have any social contact with even the common people among shia populations.Only Elite of the shia;s were able to see him. Even so he spent most of his time in prison.
There was extreme repression at that time because the shia population had reached a considerable level in both in number and power.Everyone knew that the shia belived in the imamate and the identity of shia imam was also known.Therefore , the kings(chilph)kept the imam under close supervision more tham ever before it tried through every possible means and through secrets plans to remove and destroy them .Also the calphate had come to know that shia belived that eleventh according to tradition cited by him as well as by the forefathers would have son who was promised Mehdi The coming of the Mehdi had been foretold in authenticated hadith of both shia and sunni scholars,For this reason the eleventh Imam more than other Imam was kept under close watch by the Caliphate.The caliph of the time had decided definatly to put an end to the imamate in shiaism through every possible means and to close doors to the imamate once and for all.
Therefore as soon as the news od the illness of eleventh imam reached al-mutamid , he sent physician and few of his trusted agents and judges to the house of the imam to be with him and observe his condition and the situation within his house at all times.After the death of the Imam they had house investgated and all the females were checked by the midwife.For two years the secret agents of the caliph searched for Imam Mehdi but all their search didnot help them .untill they lost hope
The eleventh Imam was burried in his house in Samarra next to his noble father..