The narrative of Numbers 22-24 never presents nor implies that Balaam wishes to harm or curse Israel. To the contrary, Balaam is presented as a loyal vassal of Yahweh, and when on three separate occasions Balak asks Balaam to pronounce curses upon Israel, Balaam refuses saying that he can only utter that which his god—Yahweh—has placed in his own mouth. Indeed, Balaam even refers to Yahweh as “my god,” which might of itself indicate that Yahweh was seen during this text’s composition as the god of the land of Transjordan, thus in effect explaining how a non-Israelite could call Yahweh his god. He was the god of this land.
In either case, other places in the Bible seem to preserve a different view of Balaam, one most likely stemming from a different tradition. In these passages (Deut 23:5-6; Josh 24:9-10; Neh 13:2), Balaam is presented as wishing harm on Israel, desiring to curse Israel and stopped only by Yahweh himself. There might be some evidence that this tradition stemmed from the ass story now incorporated into Numbers 22.
Likewise Numbers 31:16, a Priestly text, adopts this negative portrait of Balaam and groups him together with the Midianites who are then blamed for the whole Baal Peor sin. He along with the Midianites are slain.
Finally, later New Testament authors seemed also to have picked up on this negative Balaam tradition.