The Biblical admonition is properly interpreted as “thou shalt not MURDER”. Killing bad guys is (1) punishment and (2) self defense.
The Ten Commandments Donât Forbid Killing
http://goddidntsaythat.com/2010/11/24/the-ten-commandments-dont-forbid-killing/