David was a deeply flawed man and he understood his need for God’s mercy in light of his greatest failures. He knew that there was nothing in him deserving of God’s mercy, but it was only because of God’s steadfast love that he could experience the mercy of God. When he confessed his sin to God and asked for forgiveness he was able again to find joy.