2 Samuel 11:23

And the messenger said unto David, Surely the men prevailed against us, and came out unto us into the field, and we were upon them even unto the entering of the gate.

The messenger told David that the opposing forces had gotten the advantage, had come out to meet Israel in the open country, and had been driven back by Israel as far as the entrance of the city gate, and the whole report had been arranged in advance so the death of Uriah could be introduced at the end without bringing blame on Joab or on David. The setting is the killing of Uriah by the sword of the Ammonites after David commanded Joab to station him where the fighting was hottest and then to withdraw support from him. Joab in fact carried out that unlawful order from the king and put Uriah in the deadly place appointed for him.

This belongs to the record of David's heinous wrong involving Uriah and Bath-sheba, the crime for which God sent Nathan to rebuke him and for which punishment afterward came upon him. That forgiveness followed does not mean the conduct was approved by God, for the sin was heinous in His sight, Nathan reproved the king, and though David was pardoned upon repentance and confession and his life was spared, punishment still fell on him. It stands in David's history as a fall into sin by one especially favored by God, who through indulgence of appetite and passion brought upon himself the divine displeasure. It is the account of his wrongdoing and its consequences, in which he turned aside from God's teachings and stained a reputation that had once been fair.

Scripture in this way faithfully preserves the failures of even men entrusted with great responsibilities, and such histories remain as warnings and lessons for every age rather than as excuses for evil, testifying that human frailty and temptation press upon all. The murder of Uriah shows what evil followed when David neglected to occupy himself in useful labor, warning that idleness leaves the mind exposed to temptation and sinful deeds, while steady, useful work helps to guard the mind against them. The driving of the battle back to the gate supplies an image of pressing forward in conflict with fixed determination.