This was because they had refused to give food and water to Israel and had hired Balaam to call down a curse on them. However, our God turned the curse into a blessing.
When Balak heard this, he was so furious that he pounded his fist against his hand and said, “I called you here to place a curse on my enemies, and you've blessed them three times.
to ask me to go to Moab and put a curse on the people who have come there from Egypt. They have settled everywhere around him, and he wants to run them off.”