David said to God, I have sinned greatly, in that I have done this thing: but now, put away, I beg you, the iniquity of your servant; for I have done very foolishly.
David’s response to Gad’s instructions indicated his true repentance. He left the decision about punishment entirely in God’s hands and did not seek to control it.