David had committed adultery with Bathsheba and arranged for her husband to be killed in battle. Upon being confronted by Nathan the prophet and realizing his sin, David pleaded with God to accept his repentance and restore his heart to right relationship with his Lord.