Deuteronomy 21:9

9 So shall you put away the innocent blood from the midst of you, when you shall do that which is right in the eyes of the LORD.

Deuteronomy 21:9 Meaning and Commentary

Deuteronomy 21:9

So shalt thou put away the guilt of innocent blood from among
you
Which otherwise, the person not being found out, and brought to just punishment for it, would devolve upon the whole. Aben Ezra interprets it the punishment of innocent blood, which, by the above method being taken, would not be inflicted on them:

when thou shalt do that which is right in the sight of the Lord;
as it was to observe this law concerning the beheading of the heifer, with all the rites and ceremonies belonging to it here enjoined; as well as every other command, statute, and ordinance of the Lord, which are all right to be done, ( Psalms 19:8 ) .

Deuteronomy 21:9 In-Context

7 and they shall answer and say, Our hands have not shed this blood, neither have our eyes seen it.
8 Forgive, the LORD, your people Yisra'el, whom you have redeemed, and don't allow innocent blood [to remain] in the midst of your people Yisra'el. The blood shall be forgiven them.
9 So shall you put away the innocent blood from the midst of you, when you shall do that which is right in the eyes of the LORD.
10 When you go forth to battle against your enemies, and the LORD your God delivers them into your hands, and you carry them away captive,
11 and see among the captives a beautiful woman, and you have a desire to her, and would take her to you as wife;
The Hebrew Names Version is in the public domain.