17 When the Philistines got word that David had been made king over all Israel, they came on the hunt for him. David heard of it and went down to the stronghold. 18 When the Philistines arrived, they deployed their forces in Raphaim Valley. 19 Then David prayed to God: "Shall I go up and fight the Philistines? Will you help me beat them?" 20 "Go up," God replied. "Count on me. I'll help you beat them." 21 The retreating Philistines dumped their idols, and David and his soldiers took them away. 22 Later there was a repeat performance. The Philistines came up again and deployed their troops in the Rephaim Valley.
Matthew Henry's Commentary on 2 Samuel 5:17-22
Commentary on 2 Samuel 5:17-25
(Read 2 Samuel 5:17-25)
The Philistines considered not that David had the presence of God with him, which Saul had forfeited and lost. The kingdom of the Messiah, as soon as it was set up in the world, was thus attacked by the powers of darkness. The heathen raged, and the kings of the earth set themselves to oppose it; but all in vain, Acts 2:2.