CoastalRat wrote:God had chosen the Israelites to be His chosen people. It was His plan to bring the Messiah into the world through them. He had promised them the land of Israel as part of His covenant with them. But God also knew that immorality and evil have a way of spreading through a society unless it is excised out. He knew that if left alone, other people living in the land He gave His people would eventually infest the Israeli society. It was God's desire to live among His people (as in, His presence in the Holy of Holies). But God, being Holy, cannot be present where sin is. God was effectively excising the sin from among Israel by instructing them to utterly destroy those they conquered within the promised land. In a figuretive way, God was trying to teach His people that sin needed to be completely removed if God was to abide with them.
You will notice that at no time did God demand that Israel go about attacking those not within the borders of the promised land and killing all of them. Israel failed to fully obey God's command, and predictably, as time passed, the Israelite society was infected with the habits of those they allowed to dwell among them. They repeatedly turned from God to worship the idols of those they did not destroy.
This is the basis for God's command that you question. God's command was not given to us, but rather was given to a specific people at a specific period of time and for a specific purpose.
If I understand you correctly you are suggesting that the reason God ordered the slaying of conquered peoples was to prevent contamination. The flaw I see in that reasoning is that God only ordered the destruction of cities that did not surrender. Those that surrendered merely got forced labor.
At Deuteronomy 20:10 the god decrees:
"When you march up to attack a city, first offer terms of peace.
If it agrees to your terms of peace and opens its gates to you,
all the people to be found in it shall serve you in forced labor.
But if it refuses to make peace with you and instead offers you
battle, lay siege to it, and when the Lord, your God, delivers it
into your hand, put every male in it to the sword, but the women
and children and livestock and all else in it that is worth
plunder you may take as your booty and you may use this plunder
of your enemies which the Lord, your God, has given you."
You will also note that in the above passage it was only the males to be killed. Women and children were to be kept as booty.
In another similar passage God is a bit more discriminating and orders all slain but the female children that had not yet slept with a man. To me that implies that not a whole lot of concern was given to sin.
Numbers 31:17-18
17 Now therefore kill every male among the little ones, and kill every woman that hath known man by lying with him.
18 But all the women children, that have not known a man by lying with him, keep alive for yourselves.