I’m not so sure that it was such a good idea for Mark Sanford to justify not resigning as governor based on David’s retention of the Judean kingship after taking Bathsheba and having her husband killed. God, exceedingly wroth, imposed some pretty severe penalties (conveyed by Nathan the Prophet in II Samuel 12:10-14):
Now therefore the sword shall never depart from thine house; because thou hast despised me, and hast taken the wife of Uriah the Hittite to be thy wife.
Thus saith the Lord, Behold, I will raise up evil against thee out of thine own house, and I will take thy wives before thine eyes, and give them unto thy neighbor, and he shall lie with thy wives in the sight of this sun.
For thou didst it secretly: but I will do this thing before all Israel, and before the sun.
And David said unto Nathan, I have sinned against the Lord. And Nathan said unto David, The Lord also hath put away thy sin; thou shalt not die.
Howbeit, because by this deed thou hast given great occasion to the enemies of the Lord to blaspheme, the child also that is born unto thee shall surely die.