It is narrated from Sayyiduna Quhayd bin Mutarrif al-Ghifari (may Allah be pleased with him) that someone asked the Prophet (peace and blessings be upon him): "If an attacker attacks me, what should I do?" He (peace and blessings be upon him) ordered him to fight him. He asked: "Then what will become of us?" He (peace and blessings be upon him) said: "If he kills you, you will be in Paradise, and if you kill him, he will be in Hell."
Hadith Referenceالمعجم الكبير للطبراني / باب القاف / 16133