Deuteronomy 21:9

9 So you shall purge the guilt of innocent blood from your midst, because you must 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 declare: "Our hands did not shed this blood, nor were we witnesses to it.
8 Absolve, O Lord, your people Israel, whom you redeemed; do not let the guilt of innocent blood remain in the midst of your people Israel." Then they will be absolved of bloodguilt.
9 So you shall purge the guilt of innocent blood from your midst, because you must do what is right in the sight of the Lord.
10 When you go out to war against your enemies, and the Lord your God hands them over to you and you take them captive,
11 suppose you see among the captives a beautiful woman whom you desire and want to marry,
New Revised Standard Version Bible, copyright 1989, 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.