We can define self-defense as the act of protecting or defending oneself, or others, when the threat of bodily harm exists. Interestingly, this phrase was first used in reference to fencing (1728 A.D.), then to boxing a century later (Online Etymology Dictionary on self-defense).
Killing while defending oneself is somewhat related to our modern definition of manslaughter. Generally speaking, the killing of another person without malice (intent) or premeditation (the killing was not planned) would be considered (in the U.S. and no doubt other countries) a form of manslaughter.
What is called "involuntary manslaughter" occurs when a person is killed due to an accident by another (for example, your car brakes fail and you accidently kill someone). A charge of voluntary manslaughter (under which defending oneself might fall) happens in the "heat of passion" such as when someone fights and kills another person with a strong blow.
Applying the commandments
Many people apply the sixth commandment to the question of self-defense. The difficulty in answering this question is due in part to different translations. The KJV translation of this commandment says we are not to kill (Exodus 20:13, Deuteronomy 5:17). This translation would mean that God does not approve of the use of deadly force for self-defense regardless of the circumstances.
The NKJV translation, however, as well as most modern versions of Scripture, translates verse 13 of Exodus 20 as "You shall not murder." Jesus confirmed the latter translation when he said we are not to murder (Matthew 19:18).
Our natural reaction to those who initiate violence against us is to protect not only ourselves but also the ones we love. Jesus said if a homeowner knew a thief was coming to his house he would not allow his home to be broken into (Matthew 24:42 - 44).
A time to kill
The above example shows that God gives us the right to protect our possessions and to do what is needed to defend ourselves (even though it says nothing about killing someone). In this regard, Ecclesiastes 3 states that there is a time to both kill and to heal.
To everything there is a season, and a time for every purpose under the heavens . . . A time to kill, and a time to heal; a time to break down, and a time to build up (Ecclesiastes 3:1, 3, HBFV).
The Jamieson, Fausset, and Brown Bible Commentary on Ecclesiastes 3 states verses 1 and 3 reveals when this killing is permitted. Taking the life of another can take place, " . . . judicially, criminals; or in wars of self-defense; not in malice. Out of this time and order, killing is murder."
In Numbers 35, instructions are given regarding six cities where a person might take refuge if he or she has killed another person. These cities of refuge were created by God to prevent someone who killed by accident from being killed themselves before they could stand a fair trial (Numbers 35:9 - 13, 15).
The JFB Commentary confirms the purpose of Israel's cities of refuge as it relates to self-defense. It states that when a person killed someone due to a sudden provocation or out of passion (unknowingly killing someone), the cities of refuge offered full protection.
It is interesting to note that, even though the cities of refuge no longer existed, churches were considered places of refuge in the Middle Ages. Our modern version of a place of refuge is putting someone who kills in jail so that they can live to stand trial. The above principles should give you plenty to think and pray about regarding defending oneself and the Bible.