كتاب الإمارة
33  
The Book on Government
(35)
Chapter: Two Men, one of whom kills the other, and both will enter Paradise
(35)
باب بَيَانِ الرَّجُلَيْنِ يَقْتُلُ أَحَدُهُمَا الآخَرَ يَدْخُلاَنِ الْجَنَّةَ ‏‏
Sahih Muslim 1890 a

It has been narrated on the authority of Abu Huraira that the Messenger of Allah (ﷺ) said:

God laughs at the two men both of whom will enter Paradise (though) one of them kills the other. They said: Messenger of Allah, how is it? He said: One of them fights in the way of Allah, the Almighty and Exalted. and dies a martyr. Then God turns in mercy to the murderer who embraces Islam, fights in the way of Allah, the Almighty and Exalted, and dies a martyr.
حَدَّثَنَا مُحَمَّدُ بْنُ أَبِي عُمَرَ الْمَكِّيُّ، حَدَّثَنَا سُفْيَانُ، عَنْ أَبِي الزِّنَادِ، عَنِ الأَعْرَجِ، عَنْ أَبِي هُرَيْرَةَ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ ‏"‏ يَضْحَكُ اللَّهُ إِلَى رَجُلَيْنِ يَقْتُلُ أَحَدُهُمَا الآخَرَ كِلاَهُمَا يَدْخُلُ الْجَنَّةَ ‏"‏ ‏.‏ فَقَالُوا كَيْفَ يَا رَسُولَ اللَّهِ قَالَ ‏"‏ يُقَاتِلُ هَذَا فِي سَبِيلِ اللَّهِ عَزَّ وَجَلَّ فَيُسْتَشْهَدُ ثُمَّ يَتُوبُ اللَّهُ عَلَى الْقَاتِلِ فَيُسْلِمُ فَيُقَاتِلُ فِي سَبِيلِ اللَّهِ عَزَّ وَجَلَّ فَيُسْتَشْهَدُ ‏"‏ ‏.‏
Reference : Sahih Muslim 1890a
In-book reference : Book 33, Hadith 188
USC-MSA web (English) reference : Book 20, Hadith 4658
  (deprecated numbering scheme)