Adonizedek, the king of Jerusalem, heard that Joshua had captured and totally destroyed Ai and had killed its king, just as he had done to Jericho and its king. He also heard that the people of Gibeon had made peace with the Israelites and were living among them.
References for Joshua 10:1
The people of Jerusalem were greatly alarmed at this because Gibeon was as large as any of the cities that had a king; it was larger than Ai, and its men were good fighters.
So Adonizedek sent the following message to King Hoham of Hebron, King Piram of Jarmuth, King Japhia of Lachish, and to King Debir of Eglon:
"Come and help me attack Gibeon, because its people have made peace with Joshua and the Israelites."
These five Amorite kings, the kings of Jerusalem, Hebron, Jarmuth, Lachish, and Eglon, joined forces, surrounded Gibeon, and attacked it.
The men of Gibeon sent word to Joshua at the camp in Gilgal: "Do not abandon us, sir! Come at once and help us! Save us! All the Amorite kings in the hill country have joined forces and have attacked us!"
So Joshua and his whole army, including the best troops, started out from Gilgal.
The Lord said to Joshua, "Do not be afraid of them. I have already given you the victory. Not one of them will be able to stand against you."
All night Joshua and his army marched from Gilgal to Gibeon, and they made a surprise attack on the Amorites.
The Lord made the Amorites panic at the sight of Israel's army. The Israelites slaughtered them at Gibeon and pursued them down the mountain pass at Beth Horon, keeping up the attack as far south as Azekah and Makkedah.
While the Amorites were running down the pass from the Israelite army, the Lord made large hailstones fall down on them all the way to Azekah. More were killed by the hailstones than by the Israelites.
On the day that the Lord gave the men of Israel victory over the Amorites, Joshua spoke to the Lord. In the presence of the Israelites he said, "Sun, stand still over Gibeon; Moon, stop over Aijalon Valley."
The sun stood still and the moon did not move until the nation had conquered its enemies. This is written in The Book of Jashar. The sun stood still in the middle of the sky and did not go down for a whole day. 1
References for Joshua 10:13
10.13 2 S 1.18+2 Si 46.4-6.
Never before, and never since, has there been a day like it, when the Lord obeyed a human being. The Lord fought on Israel's side!
After this, Joshua and his army went back to the camp at Gilgal.