Yahweh told Joshua that his army was defeated because Israel had sinned by stealing some of the things dedicated for destruction.