One day David heard the news, “The Philistines are attacking Keilah and stealing the grain from the threshing floors.” So he asked advice from the Lord, “Should I go and attack these Philistines?”
The Lord told David, “Go and attack the Philistines and save Keilah.”
But David's men told him, “Even here in Judah we feel afraid. If we went to Keilah to fight the Philistine armies we'd be absolutely terrified!”
So David asked advice from the Lord again, and the Lord told him, “Go immediately to Keilah, for I will give you victory over the Philistines.”
Then David and his men went to Keilah and fought the Philistines. They slaughtered them and drove off their livestock. By doing this David saved the people of Keilah. (When Abiathar, son of Ahimelech, ran away to David at Keilah he brought the ephod with him.)
When Saul found out that David had gone to Keilah, he said, “God has handed him over to me, because he has locked himself inside a town with gates that can be barred shut.” So Saul called up his whole army to go and attack Keilah and to besiege David and his men.
When David learned that Saul was plotting to attack him, he asked Abiathar the priest, “Please bring the ephod.”
10 David prayed, “Lord, God of Israel, I your servant have been clearly told that Saul plans to come to Keilah and destroy the town because of me. 11 Are the town leaders of Keilah going to hand me over to him? Is Saul going to come, as I have heard? Lord, God of Israel, please tell me.”
“Yes, he'll come,” the Lord replied.
12 “And will the town leaders of Keilah hand me and my men over to Saul?” David asked.
“Yes, they will,” the Lord replied.
13 So David and his men, who numbered around six hundred, left Keilah and moved around from place to place. When Saul discovered that David had escaped from Keilah, he didn't bother going there. 14 David set up camp in the wilderness strongholds, staying in the mountains of the Desert of Ziph. Saul searched for him continually, but God did not let David be captured.
15 While David was staying at Horesh in the Desert of Ziph, he found out* “Found out”: or “was afraid.” that Saul was on his way to murder him. 16 Saul's son Jonathan went to see David in Horesh and encouraged him to go on trusting in God, telling him, 17 “Don't worry, because my father Saul is never going to find you. You're going to be king of Israel, and I'll be your deputy. Even my father Saul knows this.” 18 The two of them made an agreement before the Lord. David stayed in Horesh and Jonathan went home.
19 Then the people of Ziph went to Saul at Gibeah and told him, “David is hiding in our area, in the strongholds in Horesh, on the hill of Hachilah, in the southern wastelands. 20 So, Your Majesty, please come whenever you want, and we'll make sure to hand him over to you.”
21 “The Lord bless you for thinking about me,” Saul replied. 22 “Please go and make absolutely sure you know exactly where he is—where he stays and who has seen him there—because people tell me that he's very devious. 23 Look for and mark down all his hiding places. Then come back to me when you're sure, and I'll go back with you. If he's here in the country, I will hunt him down among all the people of Judah.”
24 So the people of Ziph set off, returning to Ziph ahead of Saul. David and his men were in the Desert of Maon in the Arabah Valley “Arabah Valley”: another name for the Jordan Valley. in the southern wastelands. 25 Saul and his men started hunting for him. When David found out, he went down to the rock, and stayed in the Desert of Maon. When Saul heard this, he chased after David in the Desert of Maon.
26 Saul was traveling along one side of the mountain, while David and his men were on the other side, rushing to get away. But just as Saul and his men were closing in on David and his men, about to capture them, 27 a messenger arrived to tell Saul, “Come at once! The Philistines have invaded the country!”
28 So Saul had to stop chasing David and went to confront the Philistines. That's why the place is called the “Rock of Escape.” 29 Then David left and went to live in the strongholds of En-gedi.

*23:15 “Found out”: or “was afraid.”

23:24 “Arabah Valley”: another name for the Jordan Valley.