Warding off an attacker who attacks the religion is a jihad and good deed, and warding off an attacker who attacks one’s self and wealth is permissible and a concession. If one is killed in the process, he is a martyr.
[Al-Furusiyyah, Ibn al-Qayyim (p. 188)]