The Messenger of Allah ﷺ said, "Allah smiles at two men, one of whom kills the other, yet both enter Paradise. One fights in the cause of Allah and is killed, then Allah accepts the repentance of his killer, who then fights and is martyred."
أن رسول الله ﷺ قال: يضحك الله إلى رجلين يقتل أحدهما الآخر كلاهما يدخل الجنة، يقاتل هذا في سبيل الله فيقتل ثم يتوب الله على القاتل فيقاتل فيستشهد.
Malik narrated it in jihad (28) from Abu Zinad, from Araj, from Abu Hurairah, who mentioned it. Bukhari narrated it in jihad and expeditions (2826) through the route of Malik, from him.Muslim narrated it in leadership (1890: 128) through the route of Sufyan, from Abu Zinad, from him, similarly.