God in His mercy doesn’t give us what we do deserve, and God in His grace gives us what we don’t deserve, and He does this because of Jesus Christ His Son who died for us on the cross. David prayed for mercy, because he knew he had sinned (v. 4). He also affirmed his integrity (v. 12), for he had walked before the Lord in humility and submission (7:8; 18:19–25; 25:21; 78:72). When confronted with his sins, he confessed them and sought the face of the Lord (2 Sam. 12:13ff.). David wanted mercy for himself but not for his enemies, except for his son Absalom (2 Sam. 18:5). Why? Because his enemies (especially Absalom) had committed treason against the Lord’s chosen and anointed king. This was not a personal vendetta on David’s part, but a concern for the future of the nation of Israel and the dynasty of David. As ruler of the land, David wielded the sword of justice (Rom. 13:1–4), and nations today punish treason with death.
More than anything else, David wanted to please God (v. 11; 18:19; 22:8; 35:27; 2 Sam. 15:26). He had confidence that the Lord would heal him, restore him to the throne, and deal with those who opposed him. Even more, he was certain that one day he would be in the presence of the Lord and serve in His holy courts in heaven forever (v. 12; 16:11; 17:15; 21:6; 101:7; 2 Sam. 7:16).