The LORD said to Joshua, "Take all the soldiers with you and go on up to Ai. Don't be afraid or discouraged. I will give you victory over the king of Ai; his people, city, and land will be yours.
You are to do to Ai and its king what you did to Jericho and its king, but this time you may keep its goods and livestock for yourselves. Prepare to attack the city by surprise from the rear."
When the king of Ai saw Joshua's men, he acted quickly. He and all his men went out toward the Jordan Valley to fight the Israelites at the same place as before, not knowing that he was about to be attacked from the rear.
and as soon as he lifted his hand, the men who had been hiding got up quickly, ran into the city and captured it. They immediately set the city on fire.
When the men of Ai looked back, they saw the smoke rising to the sky. There was no way for them to escape, because the Israelites who had run toward the barren country now turned around to attack them.
The Israelites in the city now came down to join the battle. So the men of Ai found themselves completely surrounded by Israelites, and they were all killed. No one got away, and no one lived through it
Joshua kept his spear pointed at Ai and did not put it down until every person there had been killed. The whole population of Ai was killed that day---twelve thousand men and women.
He hanged the king of Ai from a tree and left his body there until evening. At sundown Joshua gave orders for the body to be removed, and it was thrown down at the entrance to the city gate. They covered it with a huge pile of stones, which is still there today.
He made it according to the instructions that Moses, the LORD's servant, had given the Israelites, as it says in the Law of Moses: "an altar made of stones which have not been cut with iron tools." On it they offered burnt sacrifices to the LORD, and they also presented their fellowship offerings.
The Israelites, with their leaders, officers, and judges, as well as the foreigners among them, stood on two sides of the LORD's Covenant Box, facing the levitical priests who carried it. Half of the people stood with their backs to Mount Gerizim and the other half with their backs to Mount Ebal. The LORD's servant Moses had commanded them to do this when the time came for them to receive the blessing.
Every one of the commandments of Moses was read by Joshua to the whole gathering, which included women and children, as well as the foreigners living among them.