Unfortunately even righteous battles can be tainted by bad motives. When in a battle think about the larger picture. You don’t want to win the battle and lose the war.
Read: Deuteronomy 20: 1,4
1 When you go out to fight your enemies and you face horses and
chariots and an army greater than your own, do not be afraid. The
Lord your God, who brought you out of the land of Egypt, is with
you! 4 For the Lord your God is going with you! He will fight for
you against your enemies, and he will give you victory!