1 Then they told David, saying, "Behold, the Philistines fight against Keilah and they rob the threshing-floors." 2 Therefore, David inquired of the LORD, saying, "Shall I go and smite these Philistines?" And the LORD said to David, "Go, smite the Philistines and save Keilah." 3 And David's men said to him, "Behold, we are afraid here in Judah. How much more then if we come to Keilah against the armies of the Philistines?" 4 Then David inquired of the LORD yet again. And the LORD answered him and said, "Arise, go down to Keilah, for I will deliver the Philistines into your hand." 5 So David and his men went to Keilah, fought with the Philistines, brought away their cattle, and smote them with a great slaughter. So David saved the inhabitants of Keilah.
6 And it came to pass, when Abiathar the son of Ahimelech fled to David to Keilah, that he came down with an ephod in his hand. 7 And it was told to Saul that David had come to Keilah. And Saul said, "God has delivered him into my hand, for he is shut in by entering into a town that has gates and bars." 8 And Saul called all the people together to war to go down to Keilah and to besiege David and his men. 9 And David knew that Saul secretly plotted mischief against him. And he said to Abiathar the priest, "Bring the ephod here." 10 Then David said, "O LORD God of Israel, your servant has certainly heard that Saul seeks to come to Keilah to destroy the city for my sake. 11 Will the men of Keilah deliver me up into his hand? Will Saul come down as your servant has heard? O LORD God of Israel, I implore you, tell your servant." And the LORD said, "He will come down." 12 Then David said, "Will the men of Keilah deliver me and my men into the hand of Saul?" And the LORD said, "They will deliver you up." 13 Then David and his men who were about six hundred arose and departed from Keilah and went wherever they could go. And it was told to Saul that David had escaped from Keilah, and he forbore to go forth. 14 And David stayed in the wilderness in strongholds and remained in a mountain in the wilderness of Ziph. And Saul sought him every day, but God did not deliver him into his hand.
15 And David saw that Saul had come out to seek his life. And David was in the wilderness of Ziph in a wood. 16 And Jonathan, Saul's son, arose and went to David into the wood and strengthened his hand in God. 17 And he said to him, "Do not fear, for the hand of Saul my father shall not find you. And you will be king over Israel, and I shall be next to you. And Saul, my father, also knows that." 18 And the two of them made a covenant before the LORD. And David stayed in the wood, and Jonathan went to his house.
19 Then the Ziphites came up to Saul at Gibeah, saying, "Does David not hide himself with us in strongholds in the wood, in the hill of Hachilah, which is on the south of Jeshimon? 20 Now therefore, O king, come down according to all the desire of your soul to come down, and our part shall be to deliver him into the king's hand." 21 And Saul said, "Blessed are you of the LORD, for you have compassion on me. 22 Go, I pray you, prepare yet and know, and see his place where his haunt is and who has seen him there, for it is told to me that he deals very subtly. 23 See therefore, and take knowledge of all the lurking-places where he hides himself and come back to me with the certainty, and I will go with you. And it shall come to pass, if he is in the land, that I will search him out throughout all the thousands of Judah."
24 And they arose and went to Ziph before Saul, but David and his men were in the wilderness of Maon, in the plain on the south of Jeshimon. 25 Saul and his men also went to seek him. And they told David. Therefore, he came down into a rock and stayed in the wilderness of Maon. And when Saul heard that, he pursued after David in the wilderness of Maon. 26 And Saul went on this side of the mountain, and David and his men on that side of the mountain. And David made haste to get away for fear of Saul, for Saul and his men compassed David and his men around to take them. 27 But there came a messenger to Saul, saying, "Make haste and come, for the Philistines have invaded the land." 28 Therefore, Saul returned from pursuing after David and went against the Philistines. Therefore, they called that place Sela-hammah-lekoth. 29 Then David went up from there and dwelt in strongholds at En-gedi.
[v.6] - "when Abiathar the son of Ahimelech fled to David" - Reference, 1st Samuel 22:20.