let's think about the 'real' world.
someone has a gun to a person's back, and you (say, as a policeman) can see that they mean to kill the person, no matter what you do. You WOULD fire to stop the person MURDERING the other, yes.
You are both confusing ethics AND logic

, because you kill the muderer, hopefully saving the person being attacked.