From Ibn Abbas who said, I heard Prophet Muhammad (saww) say, "O the Muslim community, know that for Allah (swt) there is a door, whoever enters it, is save from the fire and from the greatest fear."
Then Abu Saeed Al-Khudhri stood up and said, "O Messenger of Allah (swt), Guide us towards this door such that we know it."
Prophet Muhammad (saww) said, "He is Ali ibn Abi Talib (as), the Master of the Guardians and Amir Al-Momineen and the brother of the Messenger of Allah (swt), and His successor over all the creations."
"O People, the one who wishes that he holds on to the strong rope which does not break/separate, then he should hold on-to the Wilayah of Ali bin Abi Talib (as). Because His Wilayah is My Wilayah, and his obedience is My obedience."
"O People, the one who wishes that he recognizes the Hujjah (proof) after Me, then he should recognize Ali bin Abi Talib (as)."
"O People, the one who is pleased that he befriends the Wilayah of Allah (swt), then he should Hold on to Ali ibn Abi Talib (as), because He is keeper of My knowledge."
"O People, the one who wishes that he meets Allah (swt) while Allah (swt) is pleased with him, Then he should believe in Wilayah of number of Imam’s (as)."
Then Jabin bin Abdullah stood up and said, “And what is the Number of the Imam’s (as)?”
Prophet Muhammad (saww) said, “O Jabir, You asked me, Allah (swt) have mercy upon you. For Islam with its entirety, the number of Imam’s (as) is the number of months and this is near (in sight of) Allah (swt) twelve months in the book of Allah (swt) on the day of the creation of the skies and the earth. [9:36]
And the number of the Imam’s (as) is the number of springs that gushed forth for Musa bin Imran (as) when He struck the sea with his staff and gushed forth from it twelve springs. [2:60] And the number of the Imam’s (as) is the number of Captains of Bani Israeel. Allah (swt) says, "Allah did take a covenant from the Children of Israel, and we appointed twelve Captains among them.” [5:12]. And the Imam’s (as) O Jabir, the first of them is Ali bin Abi Talib (as) and the last of them is Al-Qaim (atfs), blessings be upon them all.
[Source: Irshaad Al-Quloob, Vol. 2, Pg. 261]
rom Prophet Muhammad (saww), "Will happen in my ummah like what was in bani israeel..... And among them were twelve Captains. Allah (swt) has said, "And we appointed twelve Captains among them.." [5:12]
[Source: Al-Manaqib - Ibn Shahr Ashoob, Vol. 1, Pg. 300]