While David was called a man after God's own heart, he was neither a perfect man nor a perfect king. So how can we account for David rejoicing that he was righteous and clean before a holy God? Examining 2 Samuel 22, Alistair Begg explains that David was not claiming sinlessness. Rather, David was expressing his trust in God's promise to blot out his transgressions. The righteousness David experienced was an imputed righteousness that all who put their faith in Jesus enjoy.