Moses had told the people not to associate with any of those people. But the Israelis took daughters of people from those people-groups to be their own wives, and gave their own daughters to men of those groups, to marry them. And as a result they started to worship the gods of those people-groups.