Abu Musa Ashari reported,

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."

Azami 7800

Sahih

عن أبي موسى الأشعري قال

جاء رجل إلى النبي ﷺ، فقال: يا رسول الله، ما القتال في سبيل الله؟ فإن أحدنا يقاتل غضبا، ويقاتل حمية، فرفع إليه رأسه، قال: - وما رفع إليه رأسه إلا أنه كان قائما- فقال: من قاتل لتكون كلمة الله هي العليا، فهو في سبيل الله عز وجل. وفي رواية: يقاتل شجاعة، ويقاتل حمية، ويقاتل رياء.

الأعظمي 7800صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Jihad
Chapter
Rulings on jihad and its etiquette
Section
Whoever fights so that the word of Allah may be supreme
Numbering
Jami al-Kamil 7800 (2nd edition)
Azami 7800