On the day of Hunayn, Hawazin, Ghatafan, and others advanced with their livestock and their families. The Prophet ﷺ had with him that day ten thousand men, along with the freed captives of Mecca. They turned and fled from him until he was left alone. On that day he called out twice, with nothing in between.He turned to his right and said, "Company of the Ansar."They replied, "At your service, Messenger of Allah. Rejoice, we are with you."Then he turned to his left and said, "Company of the Ansar."They replied, "At your service, Messenger of Allah. Rejoice, we are with you."He was on a white mule. He dismounted and said, "I am the slave of Allah and His Messenger." The polytheists were defeated, and the Messenger of Allah ﷺ took abundant spoils. He distributed them among the Muhajirun and the freed captives, but gave the Ansar nothing.The Ansar said, "When things are hard, we are the ones called upon, yet the spoils are given to others."This reached him, so he gathered them in a tent and said, "Company of the Ansar, what is this report that has reached me about you?" They were silent.He said, "Company of the Ansar, are you not pleased that the people take worldly goods while you take Muhammad with you, leading him back to your homes?"They said, "Yes indeed, Messenger of Allah, we are pleased."He said, "If the people were to travel through one valley and the Ansar through a mountain pass, I would take the pass of the Ansar."Hisham said, I asked, "Abu Hamza, were you a witness to that?"He replied, "And where would I have been absent from him?"
لما كان يوم حنين أقبلت هوازن وغطفان وغيرهم بنعمهم وذراريهم، ومع النبي ﷺ يومئذ عشرة آلاف ومعه الطلقاء، فأدبروا عنه حتى بقي وحده، فنادى يومئذ نداءين لم يخلط بينهما شيئا، قال: فالتفت عن يمينه، فقال: يا معشر الأنصار. قالوا: لبيك يا رسول الله أبشر نحن معك. ثم التفت عن يساره، فقال: يا معشر الأنصار قالوا: لبيك يا رسول الله أبشر نحن معك. وهوعلى بغلة بيضاء، فنزل فقال: أنا عبد الله ورسوله، فانهزم المشركون، وأصاب رسول الله ﷺ غنائم كثيرة، فقسم في المهاجرين والطلقاء ولم يعط الأنصار شيئا، فقالت الأنصار: إذا كانت الشدة فنحن ندعى، وتعطى الغنائم غيرنا. فبلغه ذلك، فجمعهم في قبة، فقال: يا معشرالأنصار ما حديث بلغني عنكم فسكتوا فقال: يا معشر الأنصار! أما ترضون أن يذهب الناس بالدنيا، وتذهبون بمحمد تحوزونه إلى بيوتكم، قالوا: بلى. يا رسول الله، رضينا، قال: فقال: لو سلك الناس واديا، وسلكت الأنصار شعبا لأخذت شعب الأنصار قال هشام: فقلت: يا أبا حمزة، أنت شاهد ذاك؟ قال: وأين أعيب عند؟
Bukhari narrated it in the chapters on military expeditions (4333), and Muslim in the chapter on zakat (1059:135), both from the hadith of Ibn Awn, from Hisham bin Zayd bin Anas, from Anas, who narrated it. The wording given is that of Muslim, and Bukhari's wording is similar.