2 Samuel 19:27

And he hath slandered thy servant unto my lord the king; but my lord the king is as an angel of God: do therefore what is good in thine eyes.

2 Samuel 19:27 belongs to the closing history of David's reign in 2 Samuel, grouped with chapter 18 and extending through chapter 20, continuing the history from the long war between the house of Saul and the house of David. Within that history it stands among the many incidents connected with David's victory over Absalom and his return to Jerusalem. That account covers the difficulties he encountered, the sad consequences of his many wives and of sons he was unable to control, Absalom's rebellion against him and the death of the petted idol of the kingdom, David's lament and his return to Jerusalem, his troubles with Joab, and his numbering of the people.

The troubles in this account, especially the calamities within David's family, followed his wrongdoing toward Uriah as retribution in kind for his sin. The detailed faithfulness in telling all these difficulties stamps the whole account with inspiration and shows that God does not hide the sins of even the greatest of kings.