1 Samuel 23
David Protects the Town of Keilah 1
One day news came to David that the Philistines were at Keilah stealing grain from the threshing floors.
David asked the LORD, "Should I go and attack them?"
"Yes, go and save Keilah," the LORD told him.
But David's men said, "We're afraid even here in Judah. We certainly don't want to go to Keilah to fight the whole Philistine army!"
So David asked the LORD again, and again the LORD replied, "Go down to Keilah, for I will help you conquer the Philistines."
So David and his men went to Keilah. They slaughtered the Philistines and took all their livestock and rescued the people of Keilah.
Now when Abiathar son of Ahimelech fled to David at Keilah, he brought the ephod with him.
Saul soon learned that David was at Keilah. "Good!" he exclaimed. "We've got him now! God has handed him over to me, for he has trapped himself in a walled town!"
So Saul mobilized his entire army to march to Keilah and besiege David and his men.
But David learned of Saul's plan and told Abiathar the priest to bring the ephod and ask the LORD what he should do.
Then David prayed, "O LORD, God of Israel, I have heard that Saul is planning to come and destroy Keilah because I am here.
Will the leaders of Keilah betray me to him? 
And will Saul actually come as I have heard? O LORD, God of Israel, please tell me."
And the LORD said, "He will come."
Again David asked, "Will the leaders of Keilah betray me and my men to Saul?"
And the LORD replied, "Yes, they will betray you."
David Hides in the Wilderness 13
So David and his men—about 600 of them now—left Keilah and began roaming the countryside. Word soon reached Saul that David had escaped, so he didn't go to Keilah after all.
David now stayed in the strongholds of the wilderness and in the hill country of Ziph. Saul hunted him day after day, but God didn't let Saul find him.
One day near Horesh, David received the news that Saul was on the way to Ziph to search for him and kill him.
Jonathan went to find David and encouraged him to stay strong in his faith in God.
"Don't be afraid," Jonathan reassured him. "My father will never find you! You are going to be the king of Israel, and I will be next to you, as my father, Saul, is well aware."
So the two of them renewed their solemn pact before the LORD. Then Jonathan returned home, while David stayed at Horesh.
But now the men of Ziph went to Saul in Gibeah and betrayed David to him. "We know where David is hiding," they said. "He is in the strongholds of Horesh on the hill of Hakilah, which is in the southern part of Jeshimon.
Come down whenever you're ready, O king, and we will catch him and hand him over to you!"
"The LORD bless you," Saul said. "At last someone is concerned about me!
Go and check again to be sure of where he is staying and who has seen him there, for I know that he is very crafty.
Discover his hiding places, and come back when you are sure. Then I'll go with you. And if he is in the area at all, I'll track him down, even if I have to search every hiding place in Judah!"
So the men of Ziph returned home ahead of Saul.
Meanwhile, David and his men had moved into the wilderness of Maon in the Arabah Valley south of Jeshimon.
When David heard that Saul and his men were searching for him, he went even farther into the wilderness to the great rock, and he remained there in the wilderness of Maon. But Saul kept after him in the wilderness.
Saul and David were now on opposite sides of a mountain. Just as Saul and his men began to close in on David and his men,
an urgent message reached Saul that the Philistines were raiding Israel again.
So Saul quit chasing David and returned to fight the Philistines. Ever since that time, the place where David was camped has been called the Rock of Escape. 
David then went to live in the strongholds of En-gedi.