David Meets King Achish of Gathby emmanuel_higgins

1 Samuel 27:6

Then Achish gave him Ziklag that day: wherefore Ziklag pertaineth unto the kings of Judah unto this day.

The verse belongs to the account of David placing himself under Philistine protection and finding asylum among them, where he remained until Saul's death.
In seeking that protection, David acted without seeking God's counsel.
It is connected with his move to live under Achish's protection with his family, household, and possessions, as though he intended to settle there permanently.
Achish welcomed David and his people into Philistine territory and promised them protection as they settled there.

Achish granted David Ziklag as a possession.
That town afterward became part of Judah's territory.
David repaid the Philistines' favor with deception.
Their kindness was self-interested, for they hoped to use David against Saul and Israel.