17 When the Philistines heard that David had been anointed king over Israel, they went up in full force to search for him, but David heard about it and went down to the stronghold. 18 Now the Philistines had come and spread out in the Valley of Rephaim; 19 so David inquired of the Lord, "Shall I go and attack the Philistines? Will you deliver them into my hands?" The Lord answered him, "Go, for I will surely deliver the Philistines into your hands." 20 So David went to Baal Perazim, and there he defeated them. He said, "As waters break out, the Lord has broken out against my enemies before me." So that place was called Baal Perazim. 1 21 The Philistines abandoned their idols there, and David and his men carried them off.
22 Once more the Philistines came up and spread out in the Valley of Rephaim; 23 so David inquired of the Lord, and he answered, "Do not go straight up, but circle around behind them and attack them in front of the poplar trees. 24 As soon as you hear the sound of marching in the tops of the poplar trees, move quickly, because that will mean the Lord has gone out in front of you to strike the Philistine army." 25 So David did as the Lord commanded him, and he struck down the Philistines all the way from Gibeon 2 to Gezer.