Sayyiduna Jarir (may Allah be pleased with him) narrates: We attended the Hajj season with the Messenger of Allah (peace and blessings be upon him), and it was the Farewell Hajj. We reached a place called Ghadir Khumm, and he (peace and blessings be upon him) had it announced: Gather for the prayer. So the Muhajirun and the Ansar all gathered, and the Messenger of Allah (peace and blessings be upon him) stood in our midst and said: "O people! To what do you bear witness?" The people said: We bear witness that there is no true god except Allah. He said: "Then what?" The people said: And that Muhammad (peace and blessings be upon him) is His servant and Messenger. He said: "Who is your wali (guardian and protector)?" The people said: Allah and His Messenger are our mawla. He said: "Who is your wali?" Then he (peace and blessings be upon him) struck his hand on the upper arm of Sayyiduna Ali (may Allah be pleased with him) and made him stand, then he pulled his arm and took hold of his forearms, and said: "Whoever has Allah and His Messenger as his mawla, then this one (Ali) is also his mawla. O Allah! Befriend whoever befriends him, and be hostile to whoever is hostile to him. O Allah! Whoever among the people loves him, be a lover of him, and whoever hates him, be one who hates him. O Allah! After the two righteous servants, I find no one on earth other than You to whom I could entrust him, so decree what is best for him." Bishr said: I asked: Who are these two righteous servants? He said: I do not know.
Hadith Referenceالمعجم الكبير للطبراني / باب الجيم / 2492