Midrash Tanchuma 22:2
"Moab was alarmed because that people was so numerous. Moab dreaded the Israelites" (Numbers 22:2). The root of the word "alarmed" is similar to and derived from the word "stranger" because Moab saw themselves as strangers, as it says that they went down to Egypt and took possession of it, and the text reads, "Each woman shall borrow from her neighbor and the lodger in her house" (Exodus 3:22). Another way to interpret this word is that "vayagor" is the language of fear, that is to say that Moab was afraid when they saw all of the land in the hands of the Israelites.
The midrash cited above provides two answers as to why Balak, the king of Moab, would send out the prophet Balaam to curse the Israelites. Both answers state fear as the emotion that provokes the desire to curse the Israelites, but they differ in identifying the root cause of the fear. The first answer provided states that the Moabites' self-perception as foreigners leads them to fear. Regardless of their actual size and strength, Balak and the Moabites couldn't see themselves as anything other than outsiders, dependent on the temporary hospitality of their hosts. This self-perception of weakness leads Balak to fear the Israelites, and to instruct Balaam to curse them. This fear is based in a past traumatic experience, the memory of being foreigners.
The second answer places the fear of Balak not in a past experience, but in present geopolitical realities. In the narrative context this midrash draws upon, the Israelites had just destroyed the entire Amorite people and taken possession of their land. Neither the text of the Torah nor the midrash seeks to assuage this fear. After all, given the recent destruction of the Amorite people, Balak and the Moabites had legitimate reasons to fear the Israelites. In the end, the goal of this midrash isn't to give a deeper meaning to the fear experienced by the Moabite; rather, this midrash seeks to delve into the possible narrative and philological origins of a certain word. With that in mind, the exercise of exploring the root cause and origins of emotion, whether personal or national, provides the foundation for rational decision making. Had Balak been able to reflect on the complex origin of his and his people's fears, he might have been able to lead away from a conflict with the Israelites.