David never went to war without consulting God first. According to Josephus in Antiquities of the Jews, this was the defining principle of his military career—and when the Philistines came to destroy him at Jerusalem, it was prophecy, not strategy, that won the day.

The Philistines had seized the Valley of the Giants just outside the city. David asked the high priest to inquire of God, received assurance of victory, then attacked from behind and routed them completely. They came back with triple the forces. This time, God gave stranger instructions: wait in the Groves of Weeping near the enemy camp and do not move until the trees begin swaying on their own, without wind. When the trees moved, David struck. The Philistines broke ranks immediately and fled all the way to Gaza.

With his enemies scattered, David turned to something that had been neglected since Saul's reign: the Ark of the Covenant. It had sat in the house of Aminadab at Kirjathjearim, essentially forgotten. David assembled priests, Levites, and the entire nation to bring it to Jerusalem in a massive procession—singers, dancers, trumpets, cymbals, and the king himself playing the harp.

Then disaster struck. At the threshing floor of Chidon, the oxen pulling the cart jolted the Ark. A man named Uzzah reached out to steady it. He died instantly. Josephus explains the reason plainly: Uzzah was not a priest, and the Ark could not be touched by unauthorized hands. God struck him down, and the place was called "the Breach of Uzzah" ever after.

David was terrified. He diverted the Ark to the house of a Levite named Obededom, where it stayed for three months. During that time, Obededom—previously a poor man of low standing—became extraordinarily prosperous. When David heard how the Ark had transformed this man's fortunes, he gathered courage and brought it into Jerusalem at last, this time with priests carrying it properly and seven companies of singers leading the way.

His wife Michal, Saul's daughter, watched from a window as the king danced wildly before the Ark. She laughed at him. David's response was sharp: he was dancing for God, who had chosen him over her father, and he would do it again whenever he pleased. Josephus records that Michal bore no children after this confrontation.

Settled in Jerusalem, David looked at his own palace of cedar and felt convicted. The Ark sat in a tent. He told the prophet Nathan he wanted to build God a proper temple. Nathan initially encouraged him, but that night God appeared to Nathan with a different plan: David had shed too much blood in war to build the house of God. That honor would belong to his son, Solomon. David accepted the verdict with joy—not for what he was denied, but for the promise that his dynasty would endure.