Deuteronomy 21:9

9 So you shall purge the guilt of innocent blood from your midst, when you do what is right in the sight 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 testify, 'Our hands did not shed this blood, neither did our eyes see it shed.
8 Forgive, O LORD, thy people Israel, whom thou hast redeemed, and set not the guilt of innocent blood in the midst of thy people Israel; but let the guilt of blood be forgiven them.'
9 So you shall purge the guilt of innocent blood from your midst, when you do what is right in the sight of the LORD.
10 "When you go forth to war against your enemies, and the LORD your God gives them into your hands, and you take them captive,
11 and see among the captives a beautiful woman, and you have desire for her and would take her for yourself as wife,
Revised Standard Version of the Bible, copyright 1952 [2nd edition, 1971] by the Division of Christian Education of the National Council of the Churches of Christ in the United States of America. Used by permission. All rights reserved.