English Basic Explanation - Chapter 17
The commentators disagree in identifying the setting and background of this Psalm. Rashi (verse 3), as well the Radak's father (cited by the Radak, verse 2), held that David composed this chapter after the incident with Batsheva. The Radak himself, however (verse 11), claimed that this chapter was written during the period when David fled from King Shaul.
When reading this Psalm according to Rashi's interpretation, whereby it expresses David's feelings after the sin with Batsheva, a number of important themes relevant to Teshuva (repentance) emerge.
Firstly, in the introductory verse, where David asks God to accept his prayers, he refers to his prayers as (among other terms) "Tzedek," or "justice," which reflects the sincerity and truthfulness with which they were spoken. Indeed, David avows in this verse that he prays "without lips of falsehood." His prayers and supplications genuinely expressed the feelings of his heart, and were not spoken as mere lip service. Saying "I have sinned" is meaningless if the confession is not declared with sincere remorse and a desire to improve.
Secondly, according to Rashi's reading of verses 4-5, David makes note of the strict, flawless piety with which he conducted himself after the incident of Batsheva. Although he failed on that occasion, he asserts, since that point he has ensured to follow the proper path of conduct, and on account of this he seeks God's compassion and forgiveness. Even after one stumbles and transgresses, he must not despair; instead, he should commit himself to working towards self-improvement, in the merit of which he can earn forgiveness for his wrongdoing.
In verses 7-13, David petitions God to save him from the enemies that surround him and seek his destruction. Rashi explains that the incident of Batsheva occurred while Benei Yisrael were at war with the neighboring nation of Amon, and David feared that on account of his transgression God might punish the entire nation with defeat. David further realized that defeat at the hands of Amon would undermine Israel's image of invincibility, and other nations would join forces and launch an attack. This demonstrates David's recognition of the far-reaching consequences of sin. Its effects are not limited to one's own well-being, but rather extend to that of the entire Jewish people.
According to Rashi and Metzudat David's interpretation of this Psalm's final verse, David prays to be included in Techiyat Ha'meitim, the resurrection of the dead, when he will be granted a clearer "picture" and understanding of God. This, too, reflects a keen awareness of the repercussions of sin, as David realizes that his misdeed could go so far as deny him the opportunity for resurrection at the end of days. He therefore pleads with God to pardon his misdeed and allow him this opportunity. Sinful conduct cannot be treated lightly; one must recognize the grave implication of his wrongdoing, and undergo a sincere process of Teshuva to avoid the potentially grave consequences of his actions.