1 Samuel 27:1-7

1 And David said in his heart, "I shall now 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 A'chish the son of Ma'och, king of Gath.
3 And David dwelt with A'chish at Gath, he and his men, every man with his household, and David with his two wives, Ahin'o-am of Jezreel, and Ab'igail of Carmel, Nabal's widow.
4 And when it was told Saul that David had fled to Gath, he sought for him no more.
5 Then David said to A'chish, "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 A'chish gave him Ziklag; therefore Ziklag has belonged to the kings of Judah to this day.
7 And the number of the days that David dwelt in the country of the Philistines was a year and four months.