Battles of Rephaim - When the civil war ended, David was finally king over all Israel. The news troubled the Philistines who were worried that Israel might become too powerful under David. So they marched to war.
"When the Philistines heard that they had anointed David king over Israel, all the Philistines went up to seek out David; and when David heard of it, he went down to the stronghold. Now the Philistines came and spread themselves out in the valley of Rephaim. Then David inquired of the Lord, saying, "Shall I go up against the Philistines? Will you give them into my hand?' And the Lord said to David, 'Go up, for I will certainly give the Philstines into you hand.' So David came to Baal-perazim and defeated them there; and he said, 'The Lord has broken through my enemies before me like the breakthrough of waters.' Therefore he named that place Baal-perazim (which means the lord who breaks out). They abandoned their idols there, so David and his men carried them away. Now the Philistines came up once more again and spread themselves out in the valley of Rephaim. When David inquired of the Lord, He said, 'You shall not go directly up; circle around behind them and come at them in front of the balsam trees. It shall be, when you hear the sound of marching in the tops of balsam trees, then you shall act promptly, for then the Lord will have gone out before you to strike the army of the Philistines.' Then David did so, just as the Lord had commanded him, and struck down the Philistines from Geba as far as Gezer." (II Samuel 5:17-25, NASB)