The Sixth Commandment (Ex. 20: 13) is sometimes translated into English as “You Shall Not Kill” (e. g. RSV, 1952). If that translation is valid then every soldier and law enforcement officer who has killed in the line of duty would be guilty of breaking a Commandment of God. In fact, that translation is not valid. The Sixth Commandment should be translated as “You Shall Not Murder” (e. g. NIV, NKJV, NAS).
In the Sixth Commandment, one word is chosen to depict first degree murder out of the seven possible verbs in Hebrew for kill. Rasah became restricted to deliberate and premeditated murder (Ps 94:6; Prov 22:13; Is 1:21; Jer 7:9; Hos 4:2, 6:9). This verb was not used for killing beasts for food (Gen 9:3), defending oneself in a nighttime attack (Ex 22:2), accidental killings (Deut 19:5) or even manslaughter (Num 35:16, 25).
For every other, of the sixteen to twenty death penalty crimes in the Old Testament, a substitute is permitted (Num 35:31). But there is no substitute punishment allowed for death which comes by the hand of a murderer. Killing for personal reasons by someone who premeditates the act is murder and is prohibited by the Sixth Commandment.