27:1 Then David said in his heart, “Now I shall perish one day by the hand of Saul. There is nothing better for me than that I should escape to the land of the Philistines. Then Saul will despair of seeking me any longer within the borders of Israel, and I shall escape out of his hand.” 2 So David arose and went over, he and the six hundred men who were with him, to Achish the son of Maoch, king of Gath. 3 And David lived with Achish at Gath, he and his men, every man with his household, and David with his two wives, Ahinoam of Jezreel, and Abigail of Carmel, Nabal's widow. 4 And when it was told Saul that David had fled to Gath, he no longer sought him.
5 Then David said to Achish, “If I have found favor in your eyes, let a place be given me in one of the country towns, that I may dwell there. For why should your servant dwell in the royal city with you?” 6 So that day Achish gave him Ziklag. Therefore Ziklag has belonged to the kings of Judah to this day. 7 And the number of the days that David lived in the country of the Philistines was a year and four months.
8 Now David and his men went up and made raids against the Geshurites, the Girzites, and the Amalekites, for these were the inhabitants of the land from of old, as far as Shur, to the land of Egypt. 9 And David would strike the land and would leave neither man nor woman alive, but would take away the sheep, the oxen, the donkeys, the camels, and the garments, and come back to Achish. 10 When Achish asked, “Where have you made a raid today?” David would say, “Against the Negeb of Judah,” or, “Against the Negeb of the Jerahmeelites,” or, “Against the Negeb of the Kenites.” 11 And David would leave neither man nor woman alive to bring news to Gath, thinking, “lest they should tell about us and say, ‘So David has done.’” Such was his custom all the while he lived in the country of the Philistines. 12 And Achish trusted David, thinking, “He has made himself an utter stench to his people Israel; therefore he shall always be my servant.” (ESV)