Abu Musa Ashari reported,

A man came to the Prophet ﷺ and asked, "One man fights for spoils, another fights for fame, and another fights to be seen. Which of them fights in the path of Allah?"He replied, "Whoever fights so that the word of Allah may be supreme is the one who fights in the path of Allah."

Azami 12383

Sahih

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

جاء رجل إلى النبي ﷺ، فقال: الرجل يقاتل للمغنم، والرجل يقاتل للذكر، والرجل يقاتل ليرى مكانه، فمن في سبيل الله؟ قال: من قاتل لتكون كلمة الله هي العليا، فهو في سبيل الله.

الأعظمي 12383صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Tafsir of the great Quran
Chapter
Virtues of Surah Baqarah
Section
His saying, "{And fight them until there is no fitnah and the religion is for Allah. But if they cease, then there is no aggression except}"
Numbering
Jami al-Kamil 12383 (2nd edition)
Azami 12383