The Angel of the LORD demanded worship and told Joshua He would fight for Israel. Without creating a chapter, I’ll tell you that this person shows up a lot in the Old Testament and is actually Jesus Christ before He came to Earth as a babe in a manger. Yes, Jesus was alive and well, since He is God, in the Old Testament and very active. So, remember how I said Jesus fought the battle of Jericho? Yeah.
Now, there was a battle that Israel fought without the Lord, because they got too confident to seek His counsel. They lost 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?