#What did Yahweh tell Joshua was the reason his army was defeated at Ai?

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