Jerusalem's King Adoni-zedek heard that Joshua had captured Ai and had wiped it out as something reserved for God. Joshua did the same thing to Ai and its king that he had done to Jericho and its king. He also heard that the population of Gibeon had made peace with Israel and were living among them.
Adoni-zedek and his peoplea were very afraid, because Gibeon was a large city, like one of the royal cities. It was larger than Ai. All its men were soldiers.
So Jerusalem's King Adoni-zedek sent word to Hebron's King Hoham, Jarmuth's King Piram, Lachish's King Japhia, and Eglon's King Debir:
"Come up and help me. We will strike at Gibeon, because it has made peace with Joshua and with the Israelites."
Then the five kings of the Amorites gathered. These were the kings of Jerusalem, Hebron, Jarmuth, Lachish, and Eglon. They went up with all their armies, camped against Gibeon, and attacked it.
The people of Gibeon sent word to Joshua in the camp at Gilgal: "Don't desert your servants! Come to us quickly. Rescue us! Help us! All the Amorite kings from the highlands have assembled together against us."
So Joshua went up from Gilgal with the entire army and all the bravest soldiers.
Then the LORD said to Joshua, "Don't be afraid of them. I have given them into your power. Not a single one of them can stand up against you."
Joshua quickly attacked them, having come up overnight from Gilgal.
Then the LORD threw them into a panic before Israel. Joshua struck a mighty blow against them at Gibeon. He chased them on the way up to Beth-horon and struck them down as far as Azekah and Makkedah.
When they were fleeing from Israel and were on the slope of Beth-horon, the LORD threw down large stones from the sky all the way to Azekah. So they died. More died from the hailstones than the Israelites killed with the sword.
On the day the LORD gave the Amorites into the power of Israel, Joshua spoke to the LORD in the presence of the Israelites: "Sun, stand still at Gibeon! and Moon, at the Aijalon Valley!"
The sun stood still and the moon stood motionless until a nation took revenge on its enemies. Isn't this written in the Jashar scroll? So the sun stood motionless in the middle of the sky. For a whole day, it was in no hurry to go down.
There hasn't been a day like it before or since, when the LORD responded to a human voice. The LORD fought for Israel.
Then Joshua along with all Israel came back to the camp at Gilgal.