And Joshua captured all these kings and their land at one time, because the Lord God of Israel fought for Israel.
God gave the land of Canaan over to Israel. It came through military conquest (a human means), yet the biblical text goes to great and careful lengths to attribute the outcome of battle as the work of God. Eventually a vast part of the Promised Land once under the rule of five different pagan kings was given over in one victory to Joshua and the children of Israel. As promised, Israel now possessed a huge chunk of the land they crossed the Jordan to receive from the hand of God.
There were losses along the way. There's the defeat at Ai over Achan's selfish sin. There's the Gibeonite deception that was a direct disobedience and ignorance of God's command. But even after these events, God kept His promise and fought for His people. Ai was eventually destroyed in a crushing lopsided second battle. And after Gibeon, five kings confederated to attack Israel, only to fall in a tremendous conquering victory that God sovereignly granted to His people.
When the text says "God fought for Israel", it is really talking about the sovereign power of God. Nothing can defeat what God has decreed. No uprising among man, no sinful disobedience, no unexpected turn of events from our point of view will ever change what God has willed.