Abu Abdullah Muhammad, surnamed ash-Shakir was born in 122/740 in Medina. He passed his early life with his grandfather for 24 years and 10 years with his family in Medina. He however kept himself silent (samit) so long as he lived in Medina. He most probably left Medina soon after the death of his grandfather in 148/765.
The Abbasid caliph Mansur also died in 158/775 and was succeeded by his son Mahdi, who according to Ignaz Goldziher in "Muslim Studies"(London, 1971, 2nd vol., p. 106), "was listed by Ibn Adi as an inventor of hadiths." He also died in 169/785 after ruling for 22 years, and was succeeded by his son, Hadi. He died in 170/786, and then his brother, Harun ar-Rashid became the next ruler till 193/809. He was also succeeded by his son, Amin.
The inimical opposition of the Abbasids against the Ismaili Imams was vigorously in continual. Abul Faraj Ispahani writes in "al-Aghani" (12th vol., p. 17) that, "Harun al-Rashid demanded of his poets that they combine his own praise with refutation of the claims of Ali's descendants and with attacks against the latter." Abul Faraja further writes that, "Harun ar-Rashid permitted himself to be glorified with things by which the prophets were praised; he did not disapprove of it and did not refuse it." (Ibid. 12th vol., p. 18)
The most earliest description of Muhammad bin Ismail is found from the work of Tabari (3rd vol., p. 2218), and in the Ismaili sources summed up in the 4th volume of "Uyun'l-Akhbar" (comp. 842/1438). Accordingly, Muhammad bin Ismail resided in Medina from where he sent his dais not only to spread Ismailism, but to search for a land of refuge where he could live unscathed. When Harun ar-Rashid learnt news of it, he sent his officials to arrest and bring the Imam to his court. When the caliph's men came to the house to carry out the orders, Muhammad bin Ismail entered an underground passage he had constructed inside his house and remained concealed until they had left. When the search for him had abated, he started on his journey, leaving behind his two sons. His whereabouts had been kept a closely guarded secret only the few specially privileged being acquainted with it and even they being pledged to the strictest secrecy.
It has been heretofore discussed that Musa Kazim had been staged as an Imam by the Abbasids on the ground of the fabricated theory of change of nass. The Abbasids had instituted an intensive search for Ismail, because they were well aware that Musa Kazim was not the true successor, otherwise he would have been executed very soon. They however failed to trace out Ismail and his son Muhammad. On the other side, the Abbasids noticed its reverse effect in Medina, where Musa Kazim was being truly adhered as an Imam. In the time of Harun ar-Rashid, finally Musa Kazim was arrested, who died in prison in 183/799. He should have been arrested and executed in 148/765, had he been truly succeeded his father.
Cyril Glasse writes in "The Concise Encyclopaedia of Islam" (London, 1989, p. 197) that, "The followers of Ismail, whose conception of the Imam was more absolute than that of the other Shiites, maintained on the contrary that the next Imam should be Ismail's son."