The children of Israel again did that which was evil in the sight of Yahweh; and Yahweh delivered them into the hand of the Philistines forty years.
Even as early as the days of Abraham, the Philistines were in Palestine.  Both Abraham and Isaac came in contact with Abimelech (a dynastic title) the king of Gerar and ruler of the Philistines, whose armed forces were commanded by a general named Phicol  (Genesis 20;  Genesis 21; and  Genesis 26).  The names Abimelech and Phicol were also the names of similar rulers in the times of Isaac, there being two incidents involved, not merely one.