Language:
كتاب الجهاد والسير
56  
Fighting for the Cause of Allah (Jihaad)
(44)
Chapter: Jihad is to be carried on whether the Muslim ruler is good or bad
(44)
باب الْجِهَادُ مَاضٍ مَعَ الْبَرِّ وَالْفَاجِرِ
Sahih al-Bukhari 2852

Narrated `Urwa Al-Bariqi:

The Prophet (ﷺ) said, "Good will remain (as a permanent quality) in the foreheads of horses (for Jihad) till the Day of Resurrection, for they bring about either a reward (in the Hereafter) or (war) booty (in this world)."

حَدَّثَنَا أَبُو نُعَيْمٍ، حَدَّثَنَا زَكَرِيَّاءُ، عَنْ عَامِرٍ، حَدَّثَنَا عُرْوَةُ الْبَارِقِيُّ، أَنَّ النَّبِيَّ صلى الله عليه وسلم قَالَ ‏ "‏ الْخَيْلُ مَعْقُودٌ فِي نَوَاصِيهَا الْخَيْرُ إِلَى يَوْمِ الْقِيَامَةِ الأَجْرُ وَالْمَغْنَمُ ‏"‏‏.‏
Reference : Sahih al-Bukhari 2852
In-book reference : Book 56, Hadith 68
USC-MSA web (English) reference : Vol. 4, Book 52, Hadith 104
  (deprecated numbering scheme)