The Lord spoke through Moses, warning Israel not to make covenants with the people of Canaan, and not to worship their gods, because it would become a problem to them,
“Observe what I command you this day. Behold, I am driving out from before you the Amorite and the Canaanite and the Hittite and the Perizzite and the Hivite and the Jebusite. Take heed to yourself, lest you make a covenant with the inhabitants of the land where you are going, lest it be a snare in your midst…” (Exodus 34.11–17).
Israel disregarded what the Lord said, and made covenants with the pagans, and worshiped their gods, and it truly became a snare to Israel, just as the Books of Judges, the Kings, and the Chronicles show.
Do you believe God knows what He is doing in telling us what to do and what to avoid?