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.
However, not even the victories of David removed the Philistines from their five cities, which they retained until the times of Nebuchadnezzar who found them allied with Egypt in the battle of Carchemish. "Nebuchadnezzar stamped out any remaining sparks of Philistine independence, deporting both the rulers and the people in 604 B.C."[3]  The religion of the Philistines was a constant threat to the Israelites.  The Philistines, of course, had in a large measure adopted the Baalim cults of ancient Canaan.  "There were temples of Dagon in Gaza and Ashdod, one of Ashtoreth in Ashkelon according to Herodotus and one to Baalzebub in Ekron. Some of these existed as late as the times of the Maccabees."[4]  The tragedy was that Israel even adopted these gods of the Philistines (Judges 10:6-7).