Even though the Midianites had no quarrel against the Jews, they had joined the Moabites in enticing the Jewish people into sin. In recompense for their consummately evil behavior, G‑d told Moses to send the Jewish army to attack the Midianites.
Baseless Hatred
לָתֵת נִקְמַת ה' בְּמִדְיָן: (במדבר לא:ג)
[Moses told the Jewish people,] “Carry out G‑d’s revenge against Midian.” Numbers 31:3

The Midianites had no reason to attack the Jews; they did so out of simple, baseless hatred. The root of baseless hatred is ego. An egocentric person feels threatened by others, for their very existence endangers his inflated sense of self. Therefore, although he may not seek to actively harm others, he will be secretly pleased when they suffer, or at least not be troubled by their suffering. Furthermore, he will be blind to other people’s good qualities. Since he is not sincere in his relationship with G‑d and the world, he cannot believe that others are.

In contrast, someone who is not egocentric focuses only on other people’s good qualities. Their suffering will genuinely trouble him, since he will judge them favorably and find no justification for their pain.

Similarly, rather than viewing differences of opinion as an affront to his selfhood, the selfless person will view them as opportunities to reach higher perspectives on the truth. He will expose his shortcomings to others and seek their guidance, thereby allowing him to solve his problems and progress in his self-refinement.1