It was narrated that Abu Musa said:
“The Prophet (ﷺ) was asked about a man who fights to prove his courage, or out of pride and honour for his close relatives, or to show off. The Messenger of Allah (ﷺ) said: ‘Whoever fights so that the Word of Allah may be supreme is the one who (is fighting) in the cause of Allah.’”
حَدَّثَنَا مُحَمَّدُ بْنُ عَبْدِ اللَّهِ بْنِ نُمَيْرٍ، حَدَّثَنَا أَبُو مُعَاوِيَةَ، عَنِ الأَعْمَشِ، عَنْ شَقِيقٍ، عَنْ أَبِي مُوسَى، قَالَ سُئِلَ النَّبِيُّ صلى الله عليه وسلم عَنِ الرَّجُلِ يُقَاتِلُ شَجَاعَةً وَيُقَاتِلُ حَمِيَّةً وَيُقَاتِلُ رِيَاءً فَقَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏ "‏ مَنْ قَاتَلَ لِتَكُونَ كَلِمَةُ اللَّهِ هِيَ الْعُلْيَا فَهُوَ فِي سَبِيلِ اللَّهِ ‏"‏ ‏.‏
GradeSahih (Darussalam)
English reference : Vol. 4, Book 24, Hadith 2783
Arabic reference : Book 24, Hadith 2889