God is always most concerned about his people and is constantly working all things together for their good and His own glory. Sometimes in order to protect the freedom and the innocent people from evil people is by going to war.
As we see in 1 Peter 2:13-14 is in agreement--God ordained government to ensure order in society by punishing evildoers:
Submit yourselves for the Lord's sake to every human institution, whether to a king as the one in authority, or to governors as sent by him for the punishment of evildoers and the praise of those who do right.
We must remember that throughout the Old Testament, the people of God were, like God, warriors. Moses, Joshua, the Judges, David, and the kings of Judah all led armies, and God helped them win their battles when they stood with Him. Examples of God helping His people win battles include His telling Joshua how to conquer Jericho (Josh. 6:2-5); telling him that an ambush was the way to destroy Ai (Josh. 8:1,2); telling David how to attack the Philistines (2 Sam. 5:22-25; 1 Chron. 14:14-16); and telling Israel how to attack the Syrian army (1 Kings 20:13,14). The faithful of the Old Testament understood that there were occasions when fighting and war were necessary, and they relied upon God, their weapons, and their training during those times.
Some people may disagree, saying that Jesus taught us to love our enemies (Matt. 5:44), turn the other cheek (Matt. 5:39), and warned us that, “all who draw the sword will die by the sword” (Matt. 26:52). But these verses do not refer to protecting one’s life, family, or nation. Jesus loved his enemies too, but he loved them by giving them every conceivable chance to turn from evil; he did not “love” them by letting them harm the innocent, for that would not be love. We saw above that when evil people refuse to take advantage of the loving opportunities they are given to turn from their wicked ways, Jesus will one day kill them to protect society. God loves His enemies too, and even gives them blessings, knowing that it is His kindness that might lead them to repentance (Rom. 2:4. But when the wicked do not respond to His love, and are a danger to the innocent, God will fight against them just as He has in the past, and the final end of the wicked and unrepentant will be His throwing them into the fires of Gehenna (Rev. 21:8).
God permits war in order that men may bear the consequences of their sins as punishment and bringing us back to God. The Bible tells us that God will one day take charge of what’s happening in the world. battles that we fight against evil, the spiritual battle continues to rage around us.