The Angel of the LORD, who was actually God the Son before He came to Earth as a baby, demanded worship and told Joshua He would fight for Israel. Yes, Jesus, being God, was very active in the Old Testament. So, remember how I said Jesus fought the battle of Jericho? Yeah.
Now, there was a battle that Israel fought without the Lord, resulting in a humiliating defeat to a puny city because someone had sinned in the camp, stealing items from Jericho after God said to leave the destroyed city’s goods for Him. Who sinned against God here?