The Philistines attacked the Israelites in formation, and when the battle spread, the Philistines defeated the Israelites, killing 4,000 of them on the battlefield.