Former Virginia Gov. Bob McDonnell, center, composes himself as he addresses the media outside federal court in Richmond, Va., Tuesday, Jan. 6, 2015. (Steve Helber/AP)

THE JUDGE’S sentence was two years in prison, or barely 20 months with time credited for good behavior. But the real punishment for former Virginia governor Robert F. McDonnell is disgrace.

At Tuesday’s sentencing hearing, U.S. District Judge James R. Spencer, who presided over the trial in which Mr. McDonnell (R) was convicted on corruption charges, heard that he had suffered enough. The judge heard that Mr. McDonnell is kind-hearted; compassionate; a devout Catholic; a man as good as his word whose talents would be wasted in prison. In the testimony of admirers and friends —nearly 450 of whom wrote letters to the judge — Mr. McDonnell is hard-working, even-tempered and loath to speak ill of others, a man respected and beloved by all.

As it happens, we also thought Mr. McDonnell was a good governor, a decent man and, until the revelations of his appalling conduct persuaded us otherwise, a judicious public servant. Yet all the praise in the world does not negate the dishonor he brought upon himself.

The public’s cynicism about politics and politicians did not begin with Mr. McDonnell. But when someone with his talents and attributes — and with his breadth of experience as a lawyer, prosecutor and attorney general — exercises such poor judgment in public office, there can be no excuse.

There can be no excuse for Mr. McDonnell’s having repeatedly accepted the largess of a favor-seeking businessman whom he referred to, disingenuously, as a “friend.” The catering at his daughter’s wedding. Golf outings. Vacations. The Rolex. The trip to the Final Four. Personal loans of tens of thousands of dollars. And many other favors for the McDonnell children, of which the former governor was surely aware.

As former governor Douglas Wilder acknowledged, even as he was appearing as a character witness for the defense, Mr. McDonnell’s behavior feeds the toxic narrative that all politicians are pocket-lining crooks, immune to the rules that delimit the conduct of ordinary citizens.

At some point, this man of broad experience should have had the discernment to distinguish between right and wrong. At some point, common sense should have told him: The rules that apply to other mortals apply also to me. I will pay my own way.

Two years in prison is a fifth of the term prosecutors sought. It may or may not be adequate to deter other public servants from following the dictates of their avarice. Yet whether two years is enough, too much or too little seems a secondary point. What matters is that Mr. McDonnell is set to report to prison Feb. 9 — a felon whose mistakes, however human, cannot be whitewashed by the weight of his better deeds and traits.