كتاب فضائل الجهاد عن رسول الله صلى الله عليه وسلم
22
The Book on Virtues of Jihad
(16)
Chapter: What Has Been Related About One Who Fights For Show And For Worldly Matters
(16)
باب مَا جَاءَ فِيمَنْ يُقَاتِلُ رِيَاءً وَلِلدُّنْيَا
Narrated Abu Musa:

"The Messenger of Allah (ﷺ) was asked about a man who fights out of bravery, one who fights out of protection (for himself or others), and one who fought to be seen. Which of them is in the cause of Allah ? He said: 'Whoever fought so that the Word of Allah is supreme, then he is in Allah's cause.'"

[Abu 'Eisa said:] There is something on this topic from 'Umar. This Hadith is Hasan Sahih.

حَدَّثَنَا هَنَّادٌ، حَدَّثَنَا أَبُو مُعَاوِيَةَ، عَنِ الأَعْمَشِ، عَنْ شَقِيقِ بْنِ سَلَمَةَ، عَنْ أَبِي مُوسَى، قَالَ سُئِلَ رَسُولُ اللَّهِ صلى الله عليه وسلم عَنِ الرَّجُلِ يُقَاتِلُ شَجَاعَةً وَيُقَاتِلُ حَمِيَّةً وَيُقَاتِلُ رِيَاءً فَأَىُّ ذَلِكَ فِي سَبِيلِ اللَّهِ قَالَ ‏ "‏ مَنْ قَاتَلَ لِتَكُونَ كَلِمَةُ اللَّهِ هِيَ الْعُلْيَا فَهُوَ فِي سَبِيلِ اللَّهِ ‏"‏ ‏.‏ قَالَ أَبُو عِيسَى وَفِي الْبَابِ عَنْ عُمَرَ ‏.‏ وَهَذَا حَدِيثٌ حَسَنٌ صَحِيحٌ ‏.‏
GradeSahih (Darussalam)
Reference : Jami` at-Tirmidhi 1646
In-book reference : Book 22, Hadith 29
English translation : Vol. 3, Book 20, Hadith 1646