The Torah also says that when the seven nations conquered the land of Israel, the men had to be killed and the women taken captive. In addition, it is described that the Jews fought with the mixed multitude (Erev Rav), but nowhere does it say that they should be killed.
We have different desires and we have to deal with them in different ways. Why?
Answer: That is right, these are all our different desires. We should not fight with anyone externally. The Torah describes the inner corrections of a person, in himself. Therefore, Amalek and the seven nations that inhabited the land of Israel until the Jews came there, and all the people around us that we had to fight, are our inner attributes that we have to fight against and change from selfish to altruistic. This, in general, is the essence of all wars.
Comment: Still, it happened as historical events.
My Response: Yes, because every spiritual force has its own effect in our world. The upper force itself is called the root, and its effect is called the branch. Therefore, we must also fulfill these conditions in the material world, which we feel in our egoistic properties, to destroy and so on, if we cannot do it on the level of the spiritual world. But, in principle, the Torah calls us to make corrections in spirituality.
From KabTV’s “Spiritual States” 5/14/21