Joshua's first victory was the wonderful capture of Jericho. The whole of the city was declared anathema, because it had been conquered on the Sabbath day. Joshua reasoned that as the Sabbath is holy, so also that which conquered on the Sabbath should be holy. The brilliant victory was followed by the luckless defeat at Ai.
In this engagement perished Jair, the son of Manasseh, whose loss was as great as if the majority of the Sanhedrin had been destroyed. Presently Joshua discovered that the cause of the defeat was the sinfulness of Israel, brought upon it by Achan, who had laid hands on some of the spoils of Jericho. Achan was a hardened transgressor and criminal from of old. During the life of Moses he had several times appropriated to his own use things that had been declared anathema, and he had committed other crimes worthy of the death penalty.
Before the Israelites crossed the Jordan, God had not visited Achan's sins upon the people as a whole, because at that time it did not form a national unit yet. But when Achan abstracted an idol and all its appurtenances from Jericho, the misfortune of Ai followed at once.