King David turns to God with a deeply personal plea, asking Him to look upon his earthly struggles and use them as the very foundation for his forgiveness. The primary approach among commentators is that there is a direct connection between experiencing hardship in this world and receiving divine pardon. Suffering and toil act as a cleansing process, which is why David presents his pain as the reason God should wipe away his sins [רש״י, מלבי״ם].
The exact nature of David's struggles can be understood in several ways. On a basic level, his experiences are seen simply as general suffering and hard work [ביאור שטיינזלץ]. However, some view this toil as an external, physical effort, specifically pointing to the grueling wars David fought on behalf of the Israelites, which were fulfilled as a divine commandment [רד״ק]. Others focus on a more internal, spiritual battle. From this perspective, the hardship reflects David's constant struggle to deny himself physical pleasures and earthly desires [אבן עזרא], or it describes his heavy emotional state of deep submission and a broken heart [מאירי].
What makes David's situation unique is that his suffering was often self-imposed. Despite being a powerful king with access to all the luxuries of the world, he deliberately chose a life of restriction. He lived like a poor man in order to save wealth for the future building of the Temple. He also humbled himself entirely, choosing to sit on the bare ground while studying Torah and administering justice. When a king actively chooses to live with such humility and embraces hardship for the sake of spiritual growth, his reward is doubled, giving his plea for forgiveness a special, undeniable strength [אלשיך].
Relying on the merit of both his physical efforts and his spiritual humility, David asks God to completely pardon and wash away [מצודת ציון, ביאור שטיינזלץ] all the sins of his past [אבן עזרא].