19When the Israeli men who were hiding saw that, they rushed out from the places where they were hiding and ran into the city. They quickly captured it and set it on fire.
20When the men of Ai looked back, they saw smoke rising from their city. But they could not escape, because the Israeli troops stopped running away.
21Joshua and his men saw that the men who had been hiding had captured the city and were burning it, and they saw the smoke rising. So they turned around and started to attack the men of Ai.
22Meanwhile, the soldiers who had captured the city came out and attacked them from the rear. So the men of Ai were caught between the two groups of Israeli soldiers. None of the men of Ai escaped. The Israelis fought until they killed all of them. Only the king of Ai was still alive.
23Then they seized the king of Ai and brought him to Joshua.