Daily Zohar 3688
Holy Zohar text. Daily Zohar -3688

Hebrew translation:

284. וַיֵּשְׁבוּ שָׂרֵי מוֹאָב. וְשָׂרֵי מִדְיָן נִפְרְדוּ מֵהֶם וְלֹא רָצוּ לָשֶׁבֶת שָׁם. וְזִקְנֵי מוֹאָב נִשְׁאֲרוּ, שֶׁכָּתוּב וַיֵּשְׁבוּ שָׂרֵי מוֹאָב, לְבַדָּם. נָאֶה עָשׂוּ מִדְיָן שֶׁנִּפְרְדוּ מִכֹּל וָכֹל מֵהֶם. וְאִלְמָלֵא לֹא הָיוּ מַכִּים בַּסּוֹף שֶׁהָיוּ בַעֲצַת בִּלְעָם, לִשְׁלֹחַ נְשׁוֹתֵיהֶם לְיִשְׂרָאֵל בַּשִּׁטִּים לְיִשְׂרָאֵל לְהַטְעוֹתָם. וְהַכָּתוּב מוֹכִיחַ אֶת חֶטְאָם, שֶׁכָּתוּב (במדבר כה) כִּי צֹרֲרִים הֵם לָכֶם בְּנִכְלֵיהֶם אֲשֶׁר נִכְּלוּ לָכֶם עַל דְּבַר פְּעוֹר וְעַל דְּבַר כָּזְבִּי בַת נְשִׂיא מִדְיָן אֲחֹתָם וְגוֹ’. בִּשְׁנֵי אֵלֶּה חָטְאוּ, וְהָיָה חֶטְאָם גָּדוֹל. הִכּוּ אַחַר כָּךְ בַּזָּנָב. וְלָכֵן אֵלּוּ נִשְׁאֲרוּ אִתּוֹ, וְאֵלּוּ הָלְכוּ לְבַדָּם.
285. דָּבָר אַחֵר וַיֵּשְׁבוּ שָׂרֵי מוֹאָב עִם בִּלְעָם – כַּמָּה נָאֶה הָיָה לָהֶם לִבְנֵי מִדְיָן שֶׁהָלְכוּ, אִם רְצוֹנָם כָּךְ. אֲבָל יְשִׁיבָה שֶׁיָּשְׁבוּ הֵם בְּמוֹאָב גָּרְמָה לָהֶם טוֹב מִשּׁוּם שֶׁנִּשְׁאֲרוּ שָׁם. וּמַה שֶּׁהָלְכוּ אוֹתָם שֶׁל מִדְיָן, גָּרְמוּ לָהֶם רָע. מָה הַטַּעַם? אֵלּוּ חָשְׁשׁוּ לִכְבוֹד דְּבַר הַקָּדוֹשׁ בָּרוּךְ הוּא, וְיָשְׁבוּ. וְאֵלּוּ לֹא חָשְׁשׁוּ לָזֶה כְּלוּם, וְהָלְכוּ לְדַרְכָּם.

.

Zohar BalakNumbers 22:8
“וַיֹּאמֶר אֲלֵיהֶם לִינוּ פֹה הַלַּיְלָה וַהֲשִׁבֹתִי אֶתְכֶם דָּבָר כַּאֲשֶׁר יְדַבֵּר יְהוָה אֵלָי וַיֵּשְׁבוּ שָׂרֵי מוֹאָב עִם בִּלְעָם.”
“And he said to them, “Lodge here tonight, and I will bring back words to you, as YHVH speaks to me.” So the princes of Moab stayed with Balaam.”

#284
The princes of Moab stayed with Balaam while the people of Midyan left. It would have been better for them if they stayed out of this plot against Israel, but they came back later with the advice of Balaam to send their women to seduce the men of Israel. Hashem told Moses to take revenge on the Midianites because of their actions against Israel, as we read in Numbers 25:18
“כִּי צֹרְרִים הֵם לָכֶם בְּנִכְלֵיהֶם אֲשֶׁר נִכְּלוּ לָכֶם עַל דְּבַר פְּעוֹר וְעַל דְּבַר כָּזְבִּי בַת נְשִׂיא מִדְיָן אֲחֹתָם הַמֻּכָּה בְיוֹם הַמַּגֵּפָה עַל דְּבַר פְּעוֹר.”
“for they harassed you with their schemes by which they seduced you in the matter of Peor and in the matter of Cozbi, the daughter of a leader of Midian, their sister, who was killed on the day of the plague because of Peor.”
The Midianites made many of Israel worship Peor, their god, and have sex with their women. These actions drew the Light from Israel to them, causing a plague in the camp of Israel. Because of that, they had to be punished.

#285
Balaam asked the people of Midian and Moab, “Lodge here tonight, and I will bring back words to you as YHVH speaks to me.”
The Midianites left, and it brought them harm. The people of Moab stayed with respect to hear the words of YHVH that would come through Balaam. The Midianites didn’t care to respect the words of the Holy One, Blessed be He, and went their ways.

Lesson;
Even though the Midianites and the Moabites were part of negative action against Israel, those who respect the Holy One are not ignored, and every positive thought or action is rewarded accordingly.

Balak built 21 altars. Seven altars in three places, and brought sacrifices of Bull and Ram on each altar, together 42 offerings.
He connected to draw Light to be used against Israel, but since the initial connection was recognition in YHVH, he was rewarded that something good will come out from him. It was Ruth the Moabite that from her descendent came King David, and later the Mashiach.

From : Sotah 47a:3 with Connections (sefaria.org)
והאמר רב יהודה אמר רב לעולם יעסוק אדם בתורה ובמצות ואע”פ שלא לשמה שמתוך שלא לשמה בא לשמה שבשכר ארבעים ושנים קרבנות שהקריב בלק מלך מואב זכה ויצתה ממנו רות שיצא ממנו שלמה שכתוב ביה (מלכים א ג, ד) אלף עולות יעלה שלמה ואמר רבי יוסי בן חוני רות בתו של עגלון בנו של בלק היתה תאותו מיהא לקללה הוי
But didn’t Rav Yehuda say that Rav says: A person should always engage in Torah study and performance of mitzvot, even if he does so not for their own sake, as through such acts performed not for their own sake, one will come to perform them for their own sake. He proves the value of a mitzva done not for its own sake: As in reward for the forty-two offerings that Balak, king of Moab, brought, he merited that Ruth descended from him, from whom King Solomon descended, about whom it is written that he brought many offerings: “A thousand burnt-offerings did Solomon offer up” (I Kings 3:4). And Rabbi Yosei ben Ḥoni similarly says: Ruth was the daughter of Eglon, son of Balak. These Sages state that Balak’s reward was to have Ruth descend from him, not that a number of Jewish people perish. The Gemara answers: His desire, in any event, was to curse the Jewish people, and his reward for sacrificing his offerings was that the curse was fulfilled in the incident involving Elisha, as well.