וַיְהִ֖י כְּשָׁמְעָ֣ם אֶת־הַתּוֹרָ֑ה וַיַּבְדִּ֥ילוּ כָל־עֵ֖רֶב מִיִּשְׂרָאֵֽל׃
And it came to pass, when they had heard the law, that they separated from Israel all the alien mixture.
Read midrashic interpretation of Nehemiah 13:3: and classical rabbinic exegesis.