Now Jericho had closed its gates because of the Israelites, and no one went in or out. But the LORD said to Joshua, "See, I have given Jericho to you with its king and its able warriors. You shall march around the city, all the soldiers going about the city once. You shall do this for six days, and on the seventh day the people shall make the attack, each man going up straight before him."
Then Joshua said to the people, "March around the city and let the armed men pass on before the ark of the LORD. You shall not shout the battle-cry nor let your voice be heard; not a word shall escape from your mouth until the day I say to you, 'Shout the battle-cry'; then you shall shout!"
So he had the ark of the LORD carried around the city once; then they returned to the camp and spent the night there. The second day they also marched around the city once and returned to the camp. Thus they did six days. The seventh day they rose early at dawn and made the circuit of the city in the same way, only on that day they marched about the city seven times. The seventh time the priests blew the trumpets, and Joshua said to the people, "Shout the battle-cry; for the LORD has given you the city. The city and all that is in it shall be sacrificed to the LORD; only Rahab and those who are with her in her house shall live, because she hid the messengers whom we sent."
So the people shouted the battle-cry and the wall fell down and they went straight up into the city and captured it. But Joshua spared the lives of Rahab and her father's family and all that she had, because she hid the messengers whom Joshua sent to explore Jericho; and they have lived among the Israelites even to this day.
Then Joshua set out with all the warriors to go up to Ai. And he selected thirty thousand brave soldiers and sent them out at night with this command, "Hide somewhere beyond the town, not very far from it, but be ready to act. I and all the people who are with me will go toward the town, but when they come out against us, we will flee before them. They will come out after us, until we have drawn them away from the town; for they will say, 'They are fleeing before us.' Then you shall rise up from where you are hiding, and take the town. When you have captured it, set it on fire."
So Joshua sent them out, and they went to the place where they were to hide and placed themselves on the west side of Ai. Joshua spent that night among the people, and rose early the next morning and gathered them, and he went up, together with the rulers of Israel, before the people to Ai. And the warriors who were with him went up and came before the town. When the king of Ai saw it, the men of the town quickly rose up and went out to fight against the Israelites, but the king did not know that men were hiding behind the town to rise up and attack him.
Then Joshua and the Israelites pretended to be beaten and fled toward the wilderness; and all the people that were in the town were called together to pursue them. So they left the town unguarded and pursued the Israelites. Then the men who were hiding rose quickly out of their place and set the town on fire. When the men of Ai looked back, they saw the smoke of the town rising to heaven; and they had no chance to flee this way or that, for the Israelites who had been fleeing to the wilderness turned back upon those who were following them. When the smoke of the town rose up, the rest of the Israelites came out of the town against them; so they were surrounded by the Israelites, some on this side, and some on that, so that they let none of the people of Ai remain or escape.