Then Joshua son of Nun sent two men secretly from Shittim as spies, saying, "Go, view the land, especially Jericho." So they went, and entered the house of a prostitute whose name was Rahab, and spent the night there.
The king of Jericho was told, "Some Israelites have come here tonight to search out the land."
Then the king of Jericho sent orders to Rahab, "Bring out the men who have come to you, who entered your house, for they have come only to search out the whole land."
But the woman took the two men and hid them. Then she said, "True, the men came to me, but I did not know where they came from.
And when it was time to close the gate at dark, the men went out. Where the men went I do not know. Pursue them quickly, for you can overtake them."
She had, however, brought them up to the roof and hidden them with the stalks of flax that she had laid out on the roof.
So the men pursued them on the way to the Jordan as far as the fords. As soon as the pursuers had gone out, the gate was shut.
Before they went to sleep, she came up to them on the roof
and said to the men: "I know that the Lord has given you the land, and that dread of you has fallen on us, and that all the inhabitants of the land melt in fear before you.
For we have heard how the Lord dried up the water of the Red Sea before you when you came out of Egypt, and what you did to the two kings of the Amorites that were beyond the Jordan, to Sihon and Og, whom you utterly destroyed.
References for Joshua 2:10
As soon as we heard it, our hearts melted, and there was no courage left in any of us because of you. The Lord your God is indeed God in heaven above and on earth below.
Now then, since I have dealt kindly with you, swear to me by the Lord that you in turn will deal kindly with my family. Give me a sign of good faith
that you will spare my father and mother, my brothers and sisters, and all who belong to them, and deliver our lives from death."
The men said to her, "Our life for yours! If you do not tell this business of ours, then we will deal kindly and faithfully with you when the Lord gives us the land."
Then she let them down by a rope through the window, for her house was on the outer side of the city wall and she resided within the wall itself.
She said to them, "Go toward the hill country, so that the pursuers may not come upon you. Hide yourselves there three days, until the pursuers have returned; then afterward you may go your way."
The men said to her, "We will be released from this oath that you have made us swear to you
if we invade the land and you do not tie this crimson cord in the window through which you let us down, and you do not gather into your house your father and mother, your brothers, and all your family.
If any of you go out of the doors of your house into the street, they shall be responsible for their own death, and we shall be innocent; but if a hand is laid upon any who are with you in the house, we shall bear the responsibility for their death.
But if you tell this business of ours, then we shall be released from this oath that you made us swear to you."
She said, "According to your words, so be it." She sent them away and they departed. Then she tied the crimson cord in the window.
They departed and went into the hill country and stayed there three days, until the pursuers returned. The pursuers had searched all along the way and found nothing.
Then the two men came down again from the hill country. They crossed over, came to Joshua son of Nun, and told him all that had happened to them.
They said to Joshua, "Truly the Lord has given all the land into our hands; moreover all the inhabitants of the land melt in fear before us."