Sahih Bukhari Volume 005, Book 057, Hadith Number 052.
Narated By Salama : Ali happened to stay behind the Prophet and (did not join him) during the battle of Khaibar for he was having eye trouble. Then he said, "How could I remain behind Allah's Apostle?" So 'Ali set out following the Prophet , When it was the eve of the day in the morning of which Allah helped (the Muslims) to conquer it, Allah's Apostle said, "I will give the flag (to a man), or tomorrow a man whom Allah and His Apostle love will take the flag," or said, "A man who loves Allah and His Apostle; and Allah will grant victory under his leadership." Suddenly came 'Ali whom we did not expect. The people said, "This is 'Ali." Allah's Apostle gave him the flag and Allah granted victory under his leadership.