The Bible does not require us to passively endure attacks from assailants. If someone breaks into our home or threatens our lives, we have a biblical and legal right to defend ourselves with deadly force if needed.
“If a thief is caught in the act of breaking into a house and is killed in the process, the person who killed the thief is not guilty” (Exodus 22:2 NLT).
What makes killing in self-defense allowable in the view of the law and the Bible is the reality that you are actually defending your own life against attack. It normally takes a jury to figure out whether you were the aggressor or shared in initiating the deadly conflict.