We learn in our Parsha, that after having utterly failed to bring Hashem to curse B’nai Yisrael, Bila’am left Balak with a scheme to seduce Jewish men to avodah zora by way of immorality (co-habitation), thus evoking Hashem’s wrath. The resultant plague killed 24,000 Jewish men and was only ended by Pinchas’ zealous act in slaying Zimri and Kosbi in one stroke of his spear.
The Midrash Says (by Rabbi Moshe Weissman, Parsha Balak, pages 350-351) indicates that Bila’am’s Ba’al Peor scheme began by attracting airev rav — those who accompanied the Jews out of Mitzrayim. But, then the attraction lured members of Shevet Shimon. The account states that Hashem revealed those who sinned by removing The Clouds of Glory from above the guilty ones.