“'O Father of Al-Hassan, bring me a pen and a paper', so the Messenger of Allah (PBUH & His Family) dictated his Will until he came to this position where he said: ‘O Ali, there will be twelve Imams after me and after them, there will be twelve Mahdis. So you, O Ali, are the first of the twelve Imams. Allah The Exalted has named you in His heavens Ali Al-Mortadha (Ali the Content), Amirul Mo’mineen (the Commander of the Believers), Al-Siddiq Al-Akbar (the Greater Truthful), Al-Farouq Al-A’tham (the Greater Judge and Differentiator between truth and falsehood), Al-Ma’moun (the Trusted), and the Mahdi (the Rightly Guided). These names may not be attributed to other than you. O Ali, you are my Vicegerent/Guardian on my own family, their living and their dead, and upon my women: Whomever I kept, she shall find me tomorrow, and whomever I divorced, I am innocent of her, I will not see her and she will not see me on the Day of Resurrection. And you are my Successor (Khalifa) on my nation after me. If death comes to you, hand it over to my son Al-Hassan, the Righteous and Benevolent. Then if death comes to him, let him hand it over to my son Al-Hussein, the Martyr, the Pure and Murdered. If death comes to him, let him hand it over to his son, the Master of Worshippers, Dhul Thafant (the one with hard skin on his knees) Ali. If death comes to him, let him hand it over to his son, Mohammed Al-Baqir (the Revealer of Knowledge). If death comes to him, let him hand it over to his son, Ja’far Al-Sadiq (the Truthful). If death comes to him, let him hand it over to his son, Musa Al-Kadhim (the Patient). If death comes to him, let him hand it over to his son, Ali Al-Ridha. If death comes to him, let him hand it over to his son, Mohammed Al-Thiqa Al-Taqqi (the Trustworthy, the God-Fearing). If death comes to him, let him hand it over to his son, Ali Al-Nasih (the Advisor). If death comes to him, let him hand it over to his son, Al-Hassan Al-Fadhil (the Meritorious). If death comes to him, let him hand it over to his son, Mohammed the Safeguarded of the Family of Mohammed, peace be upon them. Those are the twelve Imams. Then there will be twelve Mahdis after him, so if death comes to him, let him hand it over to his son, the first of the close ones, he has three names, one like mine and my father’s and it is Abdullah (Servant of God), and Ahmed (the Praised), and the third name is Al-Mahdi (the Guided) and he is the first of the believers.”
– Al-Ghayba, Mohammed ibn Al-Hassan ‘Al-Toosi’, 3rd ed., p. 150, hadith 111
– Bihar Al-Anwar, Mohammed Baqir Al-Majlisi, 3rd ed., v.36, p.260-261, hadith 81 and v.53, p.147-148, hadith 6