Praise be to Allah.
Protecting oneself and one’s honour, mind, wealth and religion is a well-established basic principle in Islam. These are the five essentials which are well known to Muslims. A person has to defend himself; it is not permissible for him to consume that which will harm him, and it is not permissible for him to allow anyone to harm him. If a person or a vicious animal etc attacks him, he has to defend himself, or his family or his property, and if he is killed he is counted as a shaheed (martyr), and the killer will be in Hell.
If the harm that will result from this aggression is little and he gives up defending himself for the sake of Allah, then undoubtedly Allah will compensate him for that, so long as this does not cause any increase in the wrongdoing against him or anyone else.