Joshua Commands the Sun To Stand Still
1 King Adonizedek of Jerusalem heard that Joshua had captured and destroyed the town of Ai, and then killed its king as he had done at Jericho. He also learned that the Gibeonites had signed a peace treaty with Israel. 2 This frightened Adonizedek and his people. They knew that Gibeon was a large town, as big as the towns that had kings, and even bigger than the town of Ai had been. And all of the men of Gibeon were warriors. 3 So Adonizedek sent messages to the kings of four other towns: King Hoham of Hebron, King Piram of Jarmuth, King Japhia of Lachish, and King Debir of Eglon. The messages said, 4 “The Gibeonites have signed a peace treaty with Joshua and the Israelites. Come and help me attack Gibeon!”
5 When these five Amorite kings called their armies together and attacked Gibeon, 6 the Gibeonites sent a message to the Israelite camp at Gilgal: “Joshua, please come and rescue us! The Amorite kings from the hill country have joined together and are attacking us. We are your servants, so don't let us down. Please hurry!”
7 Joshua and his army, including his best warriors, left Gilgal. 8 “Joshua,” the Lord said, “don't be afraid of the Amorites. They will run away when you attack, and I will help you defeat them.”
9 Joshua marched all night from Gilgal to Gibeon and made a surprise attack on the Amorite camp. 10 The Lord made the enemy panic, and the Israelites started killing them right and left. They chased the Amorite troops up the road to Beth-Horon and kept on killing them, until they reached the towns of Azekah and Makkedah. 11 And while these troops were going down through Beth-Horon Pass, the Lord made huge hailstones fall on them all the way to Azekah. More of the enemy soldiers died from the hail than from the Israelite weapons.
12-13 The Lord was helping the Israelites defeat the Amorites that day. So about noon, Joshua prayed to the Lord loud enough for the Israelites to hear:

“Our Lord, make the sun stop
in the sky over Gibeon,
and the moon stand still
over Aijalon Valley.”
So the sun and the moon
stopped and stood still
until Israel defeated its enemies.

This poem can be found in The Book of Jashar. The sun stood still and didn't go down for about a whole day. 14 Never before and never since has the Lord done anything like that for someone who prayed. The Lord was really fighting for Israel.
15 After the battle, Joshua and the Israelites went back to their camp at Gilgal.
Joshua Kills the Five Enemy Kings
16 While the enemy soldiers were running from the Israelites, the five enemy kings ran away and hid in a cave near Makkedah. 17 Joshua's soldiers told him, “The five kings have been found in a cave near Makkedah.”
18 Joshua answered, “Roll some big stones over the mouth of the cave and leave a few soldiers to guard it. 19 But you and everyone else must keep going after the enemy troops, because they will be safe if they reach their walled towns. Don't let them get away! The Lord our God is helping us get rid of them.” 20 So Joshua and the Israelites almost wiped out the enemy soldiers. Only a few safely reached their walled towns.
21 The Israelite army returned to their camp at Makkedah, where Joshua was waiting for them. No one around there dared say anything bad about the Israelites. 22 Joshua told his soldiers, “Now, move the rocks from the entrance to the cave and bring those five kings to me.”
23 The soldiers opened the entrance to the cave and brought out the kings of Jerusalem, Hebron, Jarmuth, Lachish, and Eglon. 24 After Joshua had called the army together, he forced the five kings to lie down on the ground. Then he called his officers forward and told them, “You fought these kings along with me, so put your feet on their necks.” The officers did this, 25 and Joshua continued, “Don't ever be afraid or discouraged. Be brave and strong. This is what the Lord will do to all your enemies.”
26 Joshua killed the five kings and told his men to hang each body on a tree. Then at sunset 27 he told some of his troops, “Take the bodies down and throw them into the cave where the kings were found. Cover the entrance to the cave with big rocks.”
Joshua's troops obeyed his orders, and those rocks are still there.
Joshua Continues the Fighting
28 Later that day, Joshua captured Makkedah and killed its king and everyone else in the town, just as he had done at Jericho.
29 Joshua and his army left Makkedah and attacked the town of Libnah. 30 The Lord let them capture the town and its king, and they killed the king and everyone else, just as they had done at Jericho.
31 Joshua then led his army to Lachish, and they set up camp around the town. They attacked, 32 and the next day the Lord let them capture the town. They killed everyone, as they had done at Libnah. 33 King Horam of Gezer arrived to help Lachish, but Joshua and his troops attacked and destroyed him and his army.
34 From Lachish, Joshua took his troops to Eglon, where they set up camp surrounding the town. They attacked, 35 captured it that same day, then killed everyone, as they had done at Lachish.
36 Joshua and his army left Eglon and attacked Hebron. 37 They captured the town and the nearby villages, then killed everyone, including the king. They destroyed Hebron in the same way they had destroyed Eglon.
38 Joshua and the Israelite army turned and attacked Debir. 39 They captured the town, and its nearby villages. Then they destroyed Debir and killed its king, together with everyone else, just as they had done with Hebron and Libnah.
40 Joshua captured towns everywhere in the land: In the central hill country and the foothills to the west, in the Southern Desert and the region that slopes down toward the Dead Sea. Whenever he captured a town, he would kill the king and everyone else, as the Lord God of Israel had commanded. 41 Joshua wiped out towns from Kadesh-Barnea to Gaza, everywhere in the region of Goshen, and as far north as Gibeon. 42-43 The Lord fought on Israel's side, so Joshua and the Israelite army were able to capture these kings and take their land. They fought one battle after another, then they went back to their camp at Gilgal after capturing all that land.
1 Now it came to pass, when Adoni-zedek king of Jerusalem had heard how Joshua had taken Ai, and had utterly destroyed it; as he had done to Jericho and her king, so he had done to Ai and her king; and how the inhabitants of Gibeon had made peace with Israel, and were among them; 2 That they feared greatly, because Gibeon was a great city, as one of the royal cities, and because it was greater than Ai, and all the men thereof were mighty. 3 Wherefore Adoni-zedek king of Jerusalem sent unto Hoham king of Hebron, and unto Piram king of Jarmuth, and unto Japhia king of Lachish, and unto Debir king of Eglon, saying, 4 Come up unto me, and help me, that we may smite Gibeon: for it hath made peace with Joshua and with the children of Israel. 5 Therefore the five kings of the Amorites, the king of Jerusalem, the king of Hebron, the king of Jarmuth, the king of Lachish, the king of Eglon, gathered themselves together, and went up, they and all their hosts, and encamped before Gibeon, and made war against it.
6 ¶ And the men of Gibeon sent unto Joshua to the camp to Gilgal, saying, Slack not thy hand from thy servants; come up to us quickly, and save us, and help us: for all the kings of the Amorites that dwell in the mountains are gathered together against us.
7 So Joshua ascended from Gilgal, he, and all the people of war with him, and all the mighty men of valour.
8 ¶ And the LORD said unto Joshua, Fear them not: for I have delivered them into thine hand; there shall not a man of them stand before thee. 9 Joshua therefore came unto them suddenly, and went up from Gilgal all night. 10 And the LORD discomfited them before Israel, and slew them with a great slaughter at Gibeon, and chased them along the way that goeth up to Beth-horon, and smote them to Azekah, and unto Makkedah. 11 And it came to pass, as they fled from before Israel, and were in the going down to Beth-horon, that the LORD cast down great stones from heaven upon them unto Azekah, and they died: they were more which died with hailstones than they whom the children of Israel slew with the sword.
12 ¶ Then spake Joshua to the LORD in the day when the LORD delivered up the Amorites before the children of Israel, and he said in the sight of Israel, Sun, stand thou still upon Gibeon; and thou, Moon, in the valley of Ajalon. 13 And the sun stood still, and the moon stayed, until the people had avenged themselves upon their enemies. Is not this written in the book of Jasher? So the sun stood still in the midst of heaven, and hasted not to go down about a whole day. 14 And there was no day like that before it or after it, that the LORD hearkened unto the voice of a man: for the LORD fought for Israel.
15 ¶ And Joshua returned, and all Israel with him, unto the camp to Gilgal. 16 But these five kings fled, and hid themselves in a cave at Makkedah. 17 And it was told Joshua, saying, The five kings are found hid in a cave at Makkedah. 18 And Joshua said, Roll great stones upon the mouth of the cave, and set men by it for to keep them: 19 And stay ye not, but pursue after your enemies, and smite the hindmost of them; suffer them not to enter into their cities: for the LORD your God hath delivered them into your hand. 20 And it came to pass, when Joshua and the children of Israel had made an end of slaying them with a very great slaughter, till they were consumed, that the rest which remained of them entered into fenced cities. 21 And all the people returned to the camp to Joshua at Makkedah in peace: none moved his tongue against any of the children of Israel. 22 Then said Joshua, Open the mouth of the cave, and bring out those five kings unto me out of the cave. 23 And they did so, and brought forth those five kings unto him out of the cave, the king of Jerusalem, the king of Hebron, the king of Jarmuth, the king of Lachish, and the king of Eglon. 24 And it came to pass, when they brought out those kings unto Joshua, that Joshua called for all the men of Israel, and said unto the captains of the men of war which went with him, Come near, put your feet upon the necks of these kings. And they came near, and put their feet upon the necks of them. 25 And Joshua said unto them, Fear not, nor be dismayed, be strong and of good courage: for thus shall the LORD do to all your enemies against whom ye fight. 26 And afterward Joshua smote them, and slew them, and hanged them on five trees: and they were hanging upon the trees until the evening. 27 And it came to pass at the time of the going down of the sun, that Joshua commanded, and they took them down off the trees, and cast them into the cave wherein they had been hid, and laid great stones in the cave’s mouth, which remain until this very day.
28 ¶ And that day Joshua took Makkedah, and smote it with the edge of the sword, and the king thereof he utterly destroyed, them, and all the souls that were therein; he let none remain: and he did to the king of Makkedah as he did unto the king of Jericho. 29 Then Joshua passed from Makkedah, and all Israel with him, unto Libnah, and fought against Libnah: 30 And the LORD delivered it also, and the king thereof, into the hand of Israel; and he smote it with the edge of the sword, and all the souls that were therein; he let none remain in it; but did unto the king thereof as he did unto the king of Jericho.
31 ¶ And Joshua passed from Libnah, and all Israel with him, unto Lachish, and encamped against it, and fought against it: 32 And the LORD delivered Lachish into the hand of Israel, which took it on the second day, and smote it with the edge of the sword, and all the souls that were therein, according to all that he had done to Libnah.
33 ¶ Then Horam king of Gezer came up to help Lachish; and Joshua smote him and his people, until he had left him none remaining.
34 ¶ And from Lachish Joshua passed unto Eglon, and all Israel with him; and they encamped against it, and fought against it: 35 And they took it on that day, and smote it with the edge of the sword, and all the souls that were therein he utterly destroyed that day, according to all that he had done to Lachish. 36 And Joshua went up from Eglon, and all Israel with him, unto Hebron; and they fought against it: 37 And they took it, and smote it with the edge of the sword, and the king thereof, and all the cities thereof, and all the souls that were therein; he left none remaining, according to all that he had done to Eglon; but destroyed it utterly, and all the souls that were therein.
38 ¶ And Joshua returned, and all Israel with him, to Debir; and fought against it: 39 And he took it, and the king thereof, and all the cities thereof; and they smote them with the edge of the sword, and utterly destroyed all the souls that were therein; he left none remaining: as he had done to Hebron, so he did to Debir, and to the king thereof; as he had done also to Libnah, and to her king.
40 ¶ So Joshua smote all the country of the hills, and of the south, and of the vale, and of the springs, and all their kings: he left none remaining, but utterly destroyed all that breathed, as the LORD God of Israel commanded. 41 And Joshua smote them from Kadesh-barnea even unto Gaza, and all the country of Goshen, even unto Gibeon. 42 And all these kings and their land did Joshua take at one time, because the LORD God of Israel fought for Israel. 43 And Joshua returned, and all Israel with him, unto the camp to Gilgal.