Later, David attacked and defeated the Philistines. He captured their town of Gath and the nearby villages.