In the Old Testament, God required the Hebrews to drive the wicked Canaanites from His promised land. Canaanite culture was saturated with infant sacrifice, ritual murder, sexual perversion, idolatry and occultism. God knew that a policy of zero tolerance toward Canaanite evil was the only way Hebrew monotheism would survive. Only then could it prepare a place for Jesus Christ, Savior of all who would trust in Him.
But although God authorized harsh measures against pagan religions, the Old Testament is devoid of racism: the conviction that other peoples are inherently evil, degenerate, or subhuman. King David, notably, descended from a Jew, Boaz, and Ruth, a godly Gentile. David included righteous Gentiles in his army, such as Uriah the Hittite. Also, David was close friends with the Sidonian king Hiram, who largely built Solomon’s temple. Gentile converts like Rahab were welcomed into the Hebrew community.