David said to himself, "One of these days I'll be swept away by Saul. There is nothing better for me than to escape immediately to the land of the Philistines. Then Saul will stop searching for me everywhere in Israel, and I'll escape from him."
References for 1 Samuel 27:1
So David set out with his 600 men and went to Achish son of Maoch, the king of Gath.
David and his men stayed with Achish in Gath. Each man had his family with him, and David had his two wives: Ahinoam of Jezreel and Abigail of Carmel, Nabal's widow.
References for 1 Samuel 27:3
When it was reported to Saul that David had fled to Gath, he no longer searched for him.
Now David said to Achish, "If I have found favor with you, let me be given a place in one of the outlying towns, so I can live there. Why should your servant live in the royal city with you?"
That day Achish gave Ziklag to him, and it still belongs to the kings of Judah today.
The time that David stayed in the Philistine territory amounted to a year and four months.
References for 1 Samuel 27:7
David and his men went up and raided the Geshurites, the Girzites, and the Amalekites. From ancient times they had been the inhabitants of the region through Shur as far as the land of Egypt.
References for 1 Samuel 27:8
Whenever David attacked the land, he did not leave a single person alive, either man or woman, but he took flocks, herds, donkeys, camels, and clothing. Then he came back to Achish,
who inquired, "Where did you raid today?" David replied, "The south country of Judah," "The south country of the Jerahmeelites," or "Against the south country of the Kenites."
References for 1 Samuel 27:10
David did not let a man or woman live to be brought to Gath, for he said, "Or they will inform on us and say, 'This is what David did.' " This was David's custom during the whole time he stayed in the Philistine territory.
So Achish trusted David, thinking, "Since he has made himself detestable to his people Israel, he will be my servant forever."