And there was war again. And David went out and fought with the Philistines, and killed them with a great slaughter. And they fled from him (1Samuel 19:8).
David, sometime later, invades the land populated by the Geshurites, Gezrites, and the Amalekites. This area lies south of the city of Ziklag. His attack is successful and he wins a victory, although the battle itself is quite brutal and bloody.
And David and his men went up and invaded the Geshurites, and the Gezrites, and the Amalekites, for they were the inhabitants of the land from the past days, as one comes into Shur, even into the land of Egypt.
And David struck the land, and did not keep alive man nor woman, and took away the sheep and the oxen and the donkeys and the camels and the clothing, and returned and came to Achish (1Samuel 27:8 - 9, HBFV).
David's wives taken
One day the city of Ziklag is attacked by the Amalekites. It is burnt to the ground and all the women of the city become prisoners. Among the female captives are two of king's wives, Ahinoam and Abigail. He asks God, through the High Priest's ephod (the Urim and Thummim), if he would be victorious if he launched a military campaign against those who raided the city. After receiving an affirmative answer, he collects 600 men and goes after the Amalekites.
David, with the help of a young Egyptian slave, finds out where those who attacked Ziklag are locating. The Amalekites are soon attacked and routed. All the people who were taken as prisoners are freed and a great amount of spoil comes to Israel. In fact, so much was taken from the Amalekites that not only Israel's fighting men but also at least thirteen cities shared in the spoils of victory!
And nothing was lacking to them, from the small to the great, even to sons and daughters, and from the spoil, even to all that they had taken to themselves (1Samuel 30:19).
David rallies all Israel to attack the city of Jebus. He takes the city, renames it Jerusalem, and makes it his capital in celebration of his victory (1Chronicles 11:5).
The Philistines, upon finding out that David is King of Israel, attack him. The Lord, however, is behind him and gives him a decisive victory over his enemies (2Samuel 5:17 - 21). Sometime after, however, the Philistines fight him again, but this time with the Moabites, Zobah, Syria, and Edom. They are all conquered, with some of them becoming his servants (2Samuel 8:2, 6, 14).
Misunderstanding leads to war
One of David's military battles is the result of a foreign ruler totally misunderstanding one of his actions and causing a war that did not need to happen.
It all started when Nahash, the Ammonite ruler, died. David, who was his friend, sends messengers to Ammon to convey his condolences. King Nahash's son Hanun, who now is the ruler of the Ammonites, receives the messengers. Ammonite leaders, however, convince Hanun that the messengers are really spies sent to explore the area so that an attack can be launched.
Hanun mistreats the emissaries and send them back. Soon afterwards, the Ammonites realize the mistake they made and that they have unnecessarily made themselves enemies of Israel. They hire 20,000 extra soldiers to help protect themselves. This, however, is to no avail, as Israel attacks the Ammonite capital and is victorious against both the Ammonites and their Syrian allies (2Samuel 10).
The greatest enemy
King David will go to war with Israel's greatest enemy, the Philistines, four more times and win each battle. (2Samuel 21:15, 18 - 20).