But if you do not drive out the inhabitants of the land from before you, then it shall come about that those whom you let remain of them will become as pricks in your eyes and as thorns in your sides, and they will trouble you in the land in which you live. And as I plan to do to them, so I will do to you.
Numbers 33:55-56 (New American Standard Bible)
As the Lord readied the nation of Israel to possess the land He had promised them, He gave very specific instructions as to what to do with the current inhabitants. The Lord knew what these would do to the nation if allowed to stay, and indeed what happened to Israel after they played the harlot to the false gods.

Obedience is a blessing. For I will never master what the Lord would rid me of.