David's terrible sin

(Arthur Pink, "David's Terrible Sin")

"Have mercy on me, O God, according to your unfailing love; according to your great compassion blot out my transgressions. Wash away all my iniquity and cleanse me from my sin. " Psalm 51:1-2

Why did God permit David to fall so fearfully, and sin so grievously?

One reason may be—that we might have set before our eyes the more clearly—the solemn fact that "the heart is deceitful above all things, and desperately wicked" (Jeremiah 17:9). Unmistakably plain as  the meaning of those words is, uttered by Him who cannot lie—yet how very slow we all are to really receive them at their face value, and acknowledge that they accurately describe the natural state of every human heart! But God has done more than make this bare statement: He has placed on record in His Word— illustrations, exemplifications, demonstrations of its verity—notably so in allowing us to see the unspeakable wickedness that still remained in the heart of David!

Also, the fearful fall of David, made way for a display of the amazing grace of God, in recovering His fallen people. If we are slow to receive what Scripture teaches concerning the depravity of the human heart and the exceeding sinfulness of sin—we are equally slow to really believe what it reveals about the covenant-faithfulness of God, the efficacy of Christ's blood to cleanse the foulest stain from those for whom it was shed, and the super-abounding grace of Him who is "the Father of mercies and the God of all comfort." Had David never sinned so grievously and sunken so low—he would have never known those infinite depths of mercy which are in the heart of God!

Also, had his terrible sin, his subsequent broken-hearted confession, and his pardon by God, never been placed in the Divine record—many of God's people throughout the centuries would have sunk in abject despair.

Also, thousands, from age to age, have by this solemn example of David's terrible sin, been rendered . . . .
  more suspicious of themselves,
  more watchful,
  more afraid of temptation,
  more dependent on the Lord,
  and more fervent in prayer.
By means of David's fall—they have, themselves, been preserved from falling!