This excerpt is taken from the book Fazail al-Jihad by Sheikh Abi Abdul Sabur Abdul Ghafoor Damni.
عن أبى هريرة أن رسول الله صلى الله عليه وسلم قال يضحك الله إلى رجلين يقتل أحدهما الآخر كلاهما يدخل الجنة فقالوا كيف يا رسول الله قال يقاتل هذا فى سبيل الله فيستشهد ثم يتوب الله على القاتل فيسلم فيقاتل فى سبيل الله عز وجل فيستشهد.
"Abu Huraira (may Allah be pleased with him) narrated that the Messenger of Allah (peace be upon him) said: 'Allah, the Blessed and Exalted, laughs at two men; one kills the other, yet both enter Paradise.' The Companions (may Allah be pleased with them) asked: 'O Messenger of Allah! How is this possible?' He (peace be upon him) said: 'One of them fights in the way of Allah and is martyred, then Allah grants the killer the ability to repent, he becomes a Muslim, then he fights in the way of Allah and is also martyred.'"
Reference: (Sahih Bukhari and Muslim) (Narrated by Muslim, Book of Leadership, Chapter on the explanation of two men where one kills the other and both enter Paradise, wording as is, Number: 1890, and Bukhari, Book of Jihad and Expedition, Chapter on the disbeliever killing the Muslim, Number: 2826)
Explanation
The rule and principle is that the killer and the killed will not be gathered together in Paradise or Hell. If the killed person and the martyr (who was martyred in the way of Allah) are destined for Paradise, then surely his killer will go to Hell. But when Allah Himself shows the wonders of His power, He laughs (which is befitting and appropriate for the Divine Being) that a person, while fighting against the disbelievers, killed a Muslim Mujahid as a martyr. Then by Allah's power, that person also attains the wealth of Islam and later becomes a martyr himself while fighting in the way of Allah on the side of the Muslims. In this way, both the killer and the killed enter Paradise. And this is the power of Allah Almighty.