"You shall not go with them" (Numbers 22:12) — because the Holy One, blessed be He, does not desire the destruction of the wicked. Balaam said: You stipulate to me that I shall not go with them; I will curse them from my own place. The Holy One, blessed be He, said to him: "You shall not curse the people." Balaam said: And do You wish that I bless them? The Holy One, blessed be He, said to him: They do not need your blessing, for they are blessed.
Why God Forbade Balaam to Curse or Even Bless Israel
Midrash Aggadah, Numbers 22:12
לא תלך עמהם. שאין הקב"ה חפץ באבידתן של רשעים, אמר בלעם אתה מתניני שלא אלך עמהם אקללם במקומי, אמר לו הקב"ה לא תאור את העם, אמר בלעם ורוצה אתה שאברכם, אמר לו הקב"ה אינם צריכים לברכתך, כי ברוך הוא: