Sayyiduna Abdullah bin Mas'ud (may Allah be pleased with him) says: On the Night of the Jinn the Messenger of Allah (peace and blessings be upon him) asked me to come along with him. I set off with him (peace and blessings be upon him) until we reached the upper part of Makkah. He (peace and blessings be upon him) drew a line for me and said: "Do not move from here." Then he (peace and blessings be upon him) turned off towards the mountains. I saw some men descending towards him (peace and blessings be upon him) from the mountaintops until they came between me and him (peace and blessings be upon him) and blocked my way. I drew my sword from its sheath and said: "I will fight until I rescue the Messenger of Allah (peace and blessings be upon him)." Then I remembered his (peace and blessings be upon him) words: "Do not move from here until I come to you." He says: I remained in that state until dawn came. Then the Prophet (peace and blessings be upon him) came while I was standing, and he said: "Are you still standing in the same state?" I said: "Even if you (peace and blessings be upon him) had stayed away a whole month, I would not have moved until you (peace and blessings be upon him) came." Then I told him (peace and blessings be upon him) what I had been about to do, and he (peace and blessings be upon him) said: "Had you gone out, I and you would never have met until the Day of Resurrection." Then he (peace and blessings be upon him) interlaced his fingers with my fingers and said: "I have been promised that the jinn and mankind will believe in me. As for mankind, they have believed in me; as for the jinn, you have seen." Then he said: "I think that the time of my death has drawn near." I said: "O Messenger of Allah! Will you not appoint Abu Bakr as your successor?" He (peace and blessings be upon him) turned away from me, and I understood that he (peace and blessings be upon him) did not approve of it. I said: "O Messenger of Allah! Will you not appoint Umar as your successor?" He (peace and blessings be upon him) turned away from me, and I understood that he (peace and blessings be upon him) did not approve of this either. I said: "O Messenger of Allah! Will you not appoint Ali as your successor?" He (peace and blessings be upon him) said: "By the One besides whom there is no god! If you all pledge allegiance to him and obey him, he will admit you all into Paradise."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 9933