Moussar sur Néhémie 13:2

כִּ֣י לֹ֧א קִדְּמ֛וּ אֶת־בְּנֵ֥י יִשְׂרָאֵ֖ל בַּלֶּ֣חֶם וּבַמָּ֑יִם וַיִּשְׂכֹּ֨ר עָלָ֤יו אֶת־בִּלְעָם֙ לְקַֽלְל֔וֹ וַיַּהֲפֹ֧ךְ אֱלֹהֵ֛ינוּ הַקְּלָלָ֖ה לִבְרָכָֽה׃

pour n’avoir pas offert le pain et l’eau aux enfants d’Israël et pour avoir stipendié contre eux Balaam, à l’effet de les maudire malédiction que notre Dieu transforma en bénédiction.

Shenei Luchot HaBerit

Concerning the above mentioned matters, the Torah wrote in Deut. 30,1: "It will be when all these things befall you, the blessing and the curse that I have set before you, and you take them to heart amidst the various nations to which the Lord your G–d has banished you, and you return to the Lord your G–d, etc." Why did the Torah see fit to mention הברכה, "the blessing," in that verse? All that needed to be mentioned is the curse which eventually would lead to repentance! We therefore see, that the Torah wanted to make the point that the curse itself is really a dimension of the blessing. This is parallel to the verse in Nechemiah 13,2: ויהפוך אלוקינו הקללה לברכה"" Our G–d turned the curse into a blessing." Bileam, who had come prepared to curse, was forced to bless instead. The angel who delights in evil was forced to give his consent to the blessings; the accuser was turned into an advocate for the defense.