Ezra - Chapter 9
In this chapter Ezra recognises that the people have failed to follow God's commands, and he takes this to God:
"Then, at the evening sacrifice, I rose from my self-abasement, with my tunic and cloak torn, and fell on my knees with my hands spread out to the Lord my God 6 and prayed: “I am too ashamed and disgraced, my God, to lift up my face to you, because our sins are higher than our heads and our guilt has reached to the heavens. ... we have forsaken the commands you gave through your servants the prophets when you said: ‘The land you are entering to possess is a land polluted by the corruption of its peoples. By their detestable practices they have filled it with their impurity from one end to the other. Therefore, do not give your daughters in marriage to their sons or take their daughters for your sons. Do not seek a treaty of friendship with them at any time, that you may be strong and eat the good things of the land and leave it to your children as an everlasting inheritance.’"
God's people were to keep themselves separate from the other nations, as a witness to Him. And they were not to intermarry with them, or adopt their pagan practices.
Similarly, Jesus calls his followers to be in the world, but not of the world. the church is his bride, and should not intermarry with the world.