 This later developed into the doctrine known as the occultation.The Mahdi appeared in early Shi'ite narratives, spread widely among Shi'ite groups and became dissociated from its historical figure, Muhammad al-Hanafiyyah.During the 10th century, based on these earlier beliefs, the doctrine of Mahdism was extensively expanded by Al-Kulayni, Ibrahim al-Qummi and Ibn Babawayh.