A man came to the Prophet ﷺ and asked, "Messenger of Allah, what counts as fighting in the cause of Allah? For one of us fights out of anger, and another fights out of tribal loyalty."The Prophet ﷺ raised his head toward him, and he only raised his head because the man was standing, and said, "Whoever fights so that the word of Allah may be supreme, he is in the cause of Allah." In another narration, "One fights out of bravery, one fights out of tribal loyalty, and one fights to show off."
جاء رجل إلى النبي ﷺ، فقال: يا رسول الله، ما القتال في سبيل الله؟ فإن أحدنا يقاتل غضبا، ويقاتل حمية، فرفع إليه رأسه، قال: - وما رفع إليه رأسه إلا أنه كان قائما- فقال: من قاتل لتكون كلمة الله هي العليا، فهو في سبيل الله عز وجل. وفي رواية: يقاتل شجاعة، ويقاتل حمية، ويقاتل رياء.
Bukhari related it in the Book of Knowledge (123), and Muslim in the Book of Leadership (1904: 151), both through Jareer, from Mansur, from Abu Waail, from Abu Musa, mentioning it. The other narration is from Bukhari in the Book of Monotheism (7458) and Muslim in the Book of Leadership (1904: 150), both through Amash, from Abu Waail Shaqiq, with the same account. Hafiz mentioned these narrations in Fath al-Bari (6/28), saying, "The upshot of their narrations is that fighting occurs for five reasons, seeking spoils, displaying courage, showing off, tribal zeal, and anger."