The Messenger of Allah ﷺ said, "Allah smiles at two men, one of whom kills the other, yet both enter Paradise."They asked, "How can that be, Messenger of Allah?"He replied, "This one kills the other, so the slain man enters Paradise. Then Allah accepts the repentance of the killer and guides him to Islam, and he goes out to struggle in the way of Allah and is martyred."
وقال رسول الله ﷺ يضحك الله لرجلين يقتل أحدهما الآخر كلاهما يدخل الجنة قالوا كيف يا رسول الله قال يقتل هذا فيلج الجنة ثم يتوب الله على الآخر فيهديه إلى الإسلام ثم يجاهد في سبيل الله فيستشهد
This is a sahih hadith. Bukhari related it in the Book of Jihad from Abdullah bin Yusuf. Muslim related it there from Ibn Umar. Nasai related it from Muhammad bin Salama and Harith bin Muskin, and from Muhammad bin Mansur. Ibn Majah related it in his Sunan from Abu Bakr. And Malik related it in the Muwatta, in the Book of Jihad, from Abu Zinad.