Muhammad ibn Isma'il al-Maktum (Arabic: مُحَمَّد ٱبْن إسْماعِيل ٱلْمَكتُوم, romanized: Muḥammad ibn Ismāʿīl al-Maktūm; c. 740–813) was the eldest son of Isma'il al-Mubarak and the seventh imam in Isma'ilism. When Isma'il died, his son Muhammad continued to live in Medina under the care of his grandfather Ja'far al-Sadiq until the latter's death in 148/765. After the death of Abd Allah al-Aftah, Muhammad was the most senior member of the Husaynid branch of the Alids. However, due to the rival group that recognised Musa al-Kazim as their imam, and the Abbasid Caliphate's persecution of all Alid partisans, Muhammad fled Medina with his sons for the east. For this reason, he was known as al-Maktum (lit. 'the hidden one'). He had two sons when living in Medina and then four more sons after his emigration, among whom was his successor Ahmad al-Wafi. Muhammad's descendants became the Fatimid dynasty that ruled Ifriqiya and later Egypt and much of the Levant, and founded Cairo.