Then the LORD spoke to Joshua. He said, "Do not be afraid. Do not lose hope. Go up and attack Ai. Take the whole army with you. I have handed the king of Ai over to you. I have given you his people, his city and his land.
"Remember what you did to Jericho and its king. You will do the same thing to Ai and its king. But this time you can keep for yourselves the livestock and everything else you take from them. Have some of your fighting men hide behind the city and take them by surprise."
So Joshua and the whole army moved out to attack Ai. He chose 30,000 of his best fighting men. He sent them out at night.
He gave them orders. He said, "Listen carefully to what I'm saying. You must hide behind the city. Don't go very far away from it. All of you must be ready to attack it.
"I and all of the men who are with me will go up to the city. The men of Ai will come out to fight against us, just as they did before. Then we'll run away from them.
They'll chase us until we've drawn them away from the city. They'll say, 'They are running away from us, just as they did before.' "When we run away from them,
come out of your hiding place. Take over the city. The LORD your God will hand it over to you.
When you have taken it, set it on fire. Do what the LORD has commanded. Make sure you obey my orders."
Then Joshua sent them away. They went to the place where they had planned to hide. They hid in a place west of Ai. It was between Bethel and Ai. But Joshua spent that night with his men.
Early the next morning Joshua brought his men together. He and the leaders of Israel marched in front of them to Ai.
The whole army that was with him marched up to the city. They stopped in front of it. They set up camp north of Ai. There was a valley between them and the city.
Joshua had chosen about 5,000 soldiers. He had ordered them to hide in a place west of Ai. It was between Bethel and Ai.
The men took up their battle positions. All of the men who were in the camp that was north of the city took up their positions. So did those who were supposed to hide west of the city. That night Joshua went into the valley.
The king of Ai saw what the army of Israel was doing. So he and all of his men hurried out of the city early in the morning. They marched out to meet Israel in battle. They went to a place that looked out over the Arabah Valley. The king didn't know that some of Israel's fighting men were hiding behind the city.
Joshua and all of his men let the men of Ai drive them back. The men of Israel ran away toward the desert.
All of the men of Ai were called out to chase them. They chased Joshua. So they were drawn away from the city.
Not even one man remained in Ai or Bethel. All of them went out to chase Israel. When they did, they left the city wide open.
Then the LORD spoke to Joshua. He said, "Point the javelin that is in your hand at Ai. I will hand the city over to you." So Joshua pointed his javelin at Ai.
As soon as he did, the men who were hiding behind the city got up quickly. They came out of their hiding places and rushed forward. They entered the city and captured it. They quickly set it on fire.
The men of Ai looked back. They saw smoke rising up from the city into the sky. But they couldn't escape in any direction. The men of Israel had been running away toward the desert. But now they turned around to face those who were chasing them.
Joshua and all of his men saw that the men who had been hiding behind the city had captured it. They also saw the smoke that was going up from it. So they turned around and attacked the men of Ai.
The men who had set Ai on fire came out of the city. They also fought against the men of Ai. So the men of Ai were caught in the middle. The army of Israel was on both sides of them. Israel struck them down. They didn't let anyone remain alive or get away.
But they took the king of Ai alive. They brought him to Joshua.
Israel finished killing all of the men of Ai. They destroyed them in the fields and in the desert where they had chased them. They struck every one of them down with their swords. Then all of the men of Israel returned to Ai. And they killed those who were left in it.
The total number of men and women they killed that day was 12,000. They put to death all of the people of Ai.
Joshua kept the javelin that was in his hand pointed at Ai. He didn't lower his hand until he and his men had totally destroyed everyone who lived there.
But this time Israel kept for themselves the livestock and everything else they had taken from the city. The LORD had directed Joshua to let them do it.
So Joshua burned Ai down. He tore it down so it could never be built again. It has been deserted to this very day.
Joshua killed the king of Ai. He stuck a pole through the body. Then he set it up where people could see it. He left it there until evening. At sunset, Joshua ordered his men to remove the body from the pole. He told them to throw the body down at the entrance of the city gate. They put a large pile of rocks over the body. That pile is still there to this very day.
Joshua built an altar to honor the Lord, the God of Israel. He built it on Mount Ebal.
Moses, the servant of the Lord, had commanded the people of Israel to do that. Joshua built the altar in keeping with what is written in the Scroll of the Law of Moses. He built an altar out of stones that iron tools had never touched. Then the people offered on the altar burnt offerings to the Lord. They also sacrificed friendship offerings on it.
Joshua copied the written law of Moses on stones. He did it while all of the people of Israel were watching.
They were standing on both sides of the ark of the covenant of the Lord. All of the people of Israel, including outsiders and citizens, were there. Israel's elders, officials and judges were also there. All of them faced the priests, who were Levites. They were carrying the ark. Half of the people stood in front of Mount Gerizim. The other half stood in front of Mount Ebal. Moses, the servant of the Lord, had earlier told them to do it. It was when he had given directions to bless the people of Israel.
Then Joshua read all of the words of the law out loud. He read the blessings and the curses. He read them in keeping with what is written in the Scroll of the Law.
Joshua read every word Moses had commanded. He read them to the whole community of Israel. That included the women and children. It also included the outsiders who were living among them.