The Messenger of Allah ﷺ said on the day of Khaybar, "I shall hand the banner to a man who loves Allah and His Messenger, and through whom Allah will grant victory."Umar said, "I had never desired leadership before that day, but I stretched myself up and made myself visible, hoping that he would hand it to me. When the next day came, however, he called for Ali and handed it to him, saying, 'Fight and do not turn back until Allah grants you victory.'"Ali advanced a short distance, then called out, "Messenger of Allah, on what basis shall I fight them?"He replied, "Until they bear witness that there is no god but Allah and that Muhammad is the Messenger of Allah ﷺ. If they do that, they have protected from me their blood and their wealth, except for what is rightfully due, and their reckoning is with Allah
."
حدثنا عفان حدثنا وهيب حدثنا سهيل عن أبيه
قال رسول الله ﷺ يوم خيبر لأدفعن الراية إلى رجل يحب الله ورسوله يفتح الله عليه قال فقال عمر فما أحببت الإمارة قبل يومئذ فتطاولت لها واستشرفت رجاء أن يدفعها إلي فلما كان الغد دعا عليا عليه السلام فدفعها إليه فقال قاتل ولا تلتفت حتى يفتح عليك فسار قريبا ثم نادى يا رسول الله علام أقاتل قال حتى يشهدوا أن لا إله إلا الله وأن محمدا رسول الله ﷺ فإذا فعلوا ذلك فقد منعوا مني دماءهم وأموالهم إلا بحقها وحسابهم على الله عز وجل
Its isnad is sahih. Bukhari related it, 4/65, in "The Virtue of Jihad," "What Was Said About the Prophet's ﷺ Banner," and Muslim in "The Virtues," "The Virtues of Ali," 4/1871, no. 2404, from Saad, and Tirmidhi, 5/638, no. 3724, in "Virtues," 21, saying, hasan sahih gharib, and Ibn Majah, 1/45, no. 121, in the introduction, "The Virtue of Ali bin Abu Talib." Abdul-Razzaq related it with its wording, no. 9637, as did Nasai in "The Distinctions of Ali," 9, 15.