2 Samuel 24:13

So Gad came to David, and told him, and said unto him, Shall seven years of famine come unto thee in thy land? or wilt thou flee three months before thine enemies, while they pursue thee? or that there be three days’ pestilence in thy land? now advise, and see what answer I shall return to him that sent me.

The offense that called forth the threefold offer was David's sin in numbering Israel, for which he was graciously permitted to choose the form of punishment: famine in the land, flight and defeat while fleeing three months before pursuing enemies, or pestilence in the land. The message was brought to him by Gad, who told him the Lord's terms and bade him advise and decide what answer should be returned to Him who sent him.

The offer did not come before repentance, but after David had already felt convicted, seen his error, humbled himself, and confessed his great sin, when confession came too late to turn aside the sentence that had already gone forth. Placed in that difficult position, David answered from continued confidence in God by choosing to fall into the hands of God and entrust himself to the Lord's great mercy, rather than be left to human hands and the cruel mercies of wicked men.

His decision was followed by swift pestilence that brought severe judgment upon Israel. In that destruction seventy thousand people died.