Abu Musa Ashari reported,

The Prophet ﷺ was asked about a man who fights out of bravery, one who fights out of zeal for his people, and one who fights to be seen. The Messenger of Allah ﷺ replied, "Whoever fights so that the word of Allah may be supreme is fighting in the cause of Allah."

Ibn Majah 2783

Sahih

حدثنا محمد بن عبد الله بن نمير حدثنا أبو معاوية عن الأعمش عن شقيق

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

سئل النبي ﷺ عن الرجل يقاتل شجاعة ويقاتل حمية ويقاتل رياء فقال رسول الله ﷺ من قاتل لتكون كلمة الله هي العليا فهو في سبيل الله

ابن ماجه 2783صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Ibn Majah
Book
Jihad
Chapter
Intention in fighting
Numbering
Darussalam 2783
Ibn Majah 2783