Yehoshua sent spies to scout out Ai and sent fewer soldiers than expected to capture the city. However, an Israelite named Achan had stolen items from the conquered city of Yericho, so God was not with them and they lost the battle. Yehoshua then came up with a new plan where he tricked the king of Ai into leaving the city undefended, allowing the Israelites to capture and burn Ai. The Israelites then rejoiced over capturing Ai.