"For you shall utterly destroy them"Deuteronomy 20:17.

We are commanded to kill the members of the Seven Canaanite Nations—to utterly eradicate them. This is because they were the original source of idolatry and its prime practitioners. In many places the Torah encourages and urges us to observe this mitzvah, and explains the reason for this mitzvah: so that we should not learn from these nations' heretical ways. The battle against the Canaanite nations is considered a "mitzvah battle."

This mitzvah was fully completed by King David, who killed the remaining members of these nations that had survived till his day, besides for a few who scattered and were absorbed into other nations.

[Translator's Note: In the Laws of Kings, Maimonides explains that the killing of the Seven Nations was a last resort, only done if the nations refused to evacuate the Holy Land, or to remain, but reject idolatry and accept upon themselves Jewish sovereignty.]