It was a great sin to take what was to be destroyed. Because of their sin, Yahweh withheld victory from the Israelites. Sin resulted in defeat in battle. Because they repented, Yahweh brought victory to Israel in Ai. (See: [[rc://en/tw/dict/bible/kt/sin]] and [[rc://en/tw/dict/bible/kt/repent]])