In Parshat Balak, Bilam is hired by Balak to curse the Jewish people, which he tries to do three times, and fails every time. Instead, Bilam ends up blessing the people, which angers Balak. As a parting gift, Bilam offers Balak some advice on how to defeat the Jewish people, suggesting that Balak entice them with improper relationships with Midianite women (24:14, 31:16). In the very next Perek (chapter), we see that his plan immediately works, causing the death of 24,000 people (25:1-9). How did Bilam know his plan would work, and why did it work?
Rabbi Dov Weinberger submits that Bilam’s plan worked because his blessings for the Jewish people were sinister and intended to engender a false sense of security and confidence among the people. This complacency let the people’s guard down such that they thought they were immune to temptations and thus faltered. While it’s important to feel pride and satisfaction with our moral achievements, it’s equally vital that we protect ourselves from outside influences and internal complacency. If morality makes us virtuous, our moral integrity will keep us that way.