Because Moses did a miracle the wrong way once, God had decided not to let him bring his people into the promised land after all. So when Moses was 120 years old, God sent him to the top of a mountain, where he saw the land from a distance, and then died. God chose Moses’s assistant Joshua to replace Moses as the leader of Israel.
The king of Jericho heard that there were Israelite spies in the land. He sent men to tell Rahab to hand over those men who had come to her house. But Rahab hid the spies and told the king’s men that the spies had already left. So they went to look for the spies elsewhere.
Rahab’s house was built into the protective wall surrounding Jericho. So she was able to help the spies sneak out of the city through a window after the city gates had been shut for the night. Because Rahab helped the spies, they promised her that she and her family would be spared when Israel invaded her land.
The spies returned to Joshua, and reported that the people of that land had heard of the genocidal Israelites, and were terrified of them. Joshua led the Israelites to the Jordan River, and the priests carrying the ark of the covenant went ahead of the people and stepped into the river. Then the water upstream stopped flowing toward them and piled up in a heap. And the people of Israel crossed over on dry land into the promised land.
They came to Jericho, but the city gates had been locked to keep them out. So the Israelite soldiers and priests marched around the city 13 times while blowing trumpets for a week. Then the army shouted, and the wall of Jericho collapsed. So the Israelites went in and killed all the people and animals, stole their money, and burned down the city, sparing only Rahab and her family.
The moral of the story
If you want to make sure you will survive the wrath of God, you should become a prostitute and commit treason.