Sayyiduna Salamah bin al-Akwa' (may Allah be pleased with him) said that Sayyiduna Ali (may Allah be pleased with him) had stayed behind the Prophet (peace and blessings be upon him) at Khaybar, as he had an eye ailment. He said: I have stayed behind the Prophet (peace and blessings be upon him)! So he set out and met the Prophet (peace and blessings be upon him) on the night whose morning brought the conquest. He (peace and blessings be upon him) said: "Tomorrow morning I will give the banner to a man, or a man will take the banner, whom Allah and His Messenger love," or he said: "who loves Allah and His Messenger, and Allah will grant victory at his hands." And it was Sayyiduna Ali (may Allah be pleased with him), though we had no expectation of him. They said: It was Sayyiduna Ali (may Allah be pleased with him) to whom the Messenger of Allah (peace and blessings be upon him) gave the banner, and Allah Almighty granted victory.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب قسم الفيء والغنيمة / 13058