The aim of this passage it to cause us to learn how Ai was defeated by the Israelites and how Isreal rededicated its self to God.
Israel lays ambush on Ai, takes the city and destroys it (Jos 8:1-29)
We are to be ruthless with sin because we are God’s children and He is holy.
God encouraged Joshua not to be afraid or distressed, but to take the fighting men and go against Ai. God had decreed that the king of Ai, his subjects, the city and the land was to fall in the hands of Israel. Ai would be destroyed by the Israelites in the same way that they did to Jericho. This time, however, the people could keep the spoils without being cursed. They would achieve this by using an ambush strategy.
Joshua, therefore, chose 30,000 men and sent them out under the cover of darkness and instructed them to hide close and behind the city of Ai and wait. Joshua and the rest of the fighting men would attack the city and pretend to be defeated and flee. The men of Ai would give chase and be drawn out of the city and the Israelites waiting behind the city would seize it and set the city on fire. This was the plan that God had given to Joshua.
Joshua remained with the men who would carry out the direct attack on Ai and early in the morning, they approached the city. They camped to the north of the city with a ravine between them and Ai. Joshua also placed 5,000 men to the west of the city. When the king of Ai saw the Israelites, he and the men of the city went out to face them. They were, however, not aware of the men who were waiting hiding behind the city. Joshua and the men who were with him pretended to be defeated and when the fled, the men of Ai gave change and left the city unguarded. When Ai was emptied of its defenses, God commanded to stretch out the weapon in his hand and when he did, the men who were waiting in ambush took the city and set it on fire.
The men of Ai saw the smoke rising from the city and realized they had nowhere to go. Joshua and his men stopped running and faced them and also the Israelites who had take the city came out. All the men of Ai were killed. The king of Ai was not killed along with his men but was brought to Joshua. After killing all the men of Ai, the Israelite went to the city and killed everyone in it. In total 12,000 residents of Ai were killed. Joshua did not draw back the hand that God had commanded him to stretch out until Ai was completely destroyed.
The Israelites spare the livestock which they took together with other spoils from the city. Ai was burned down and left a ruin. The king of Ai was hanged and Joshua commanded that his body be taken down at sunset. The king’s body was thrown at the entrance of the city and a great heap of stones raised on it.
Revelation 16:17-21 The seventh angel poured out his bowl into the air, and a loud voice came out of the temple, from the throne, saying, “It is done!” And there were flashes of lightning, rumblings, peals of thunder, and a great earthquake such as there had never been since man was on the earth, so great was that earthquake. The great city was split into three parts, and the cities of the nations fell, and God remembered Babylon the great, to make her drain the cup of the wine of the fury of his wrath. And every island fled away, and no mountains were to be found. And great hailstones, about one hundred pounds each, fell from heaven on people; and they cursed God for the plague of the hail, because the plague was so severe.
Joshua builds an altar, makes offering on it and reads the whole of the book of the law before the Israelites (Jos 8:30-35)
The Bible provides guidelines on the right way to worship God.
Joshua then built and altar to God on Mount Ebal following the instructions of Moses and offered burnt and peace offering to God. He wrote a copy of the law that Moses had received from God on the stones of the altar. Half the people stood on Mount Gerizim and half them on Mount Ebal. The ark of the covenant was between them and the people were blessed as Moses instructed in Deuteronomy 11:29. Joshua read all of the law, the blessings, and the curses in front of all of Israel.
John 4:22-24 You worship what you do not know; we worship what we know, for salvation is from the Jews. But the hour is coming, and is now here, when the true worshipers will worship the Father in spirit and truth, for the Father is seeking such people to worship him. God is spirit, and those who worship him must worship in spirit and truth.”