Updated on April 10 at 7:10 p.m.

The strange, sad saga of Robert Bentley’s governorship of Alabama is over.

The Republican was booked in the Montgomery County jail Monday afternoon on  a pair of misdemeanor campaign-finance charges. He pled guilty to both as part of a deal that sidesteps the four felony charges he might have faced. He later resigned, bringing to a close one of the odder sex scandals in recent memory, something like a soft-core porno by Robert Penn Warren.

Impeachment proceedings for the governor were to begin Monday in Montgomery. Last week, the Alabama Ethics Commission found probable cause that Bentley had broken ethics and campaign-finance laws. On Friday, Bentley convinced a judge to block the impeachment hearings, and he refused to step down. “I do not plan to resign. I have done nothing illegal,” he said at a news conference. “If the people want to know if I misused state resources, the answer is simply no. I have not.”

But on Saturday, the state supreme court reversed the injunction, clearing the way for impeachment to start.

Bentley was replaced by Lieutenant Governor Kay Ivey, who is also a Republican. She will be Alabama’s second female governor, after Lurleen Burns Wallace, George Wallace’s wife.

Some politicians are dogged by reputations as womanizers or prone to corruption for much of their careers. But the story of how Bentley, an unassuming, awkward, and devout Christian doctor with an undistinguished legislative career, became Alabama’s most notorious governor since George Wallace remains difficult to believe, more than a year after the scandal first emerged.

The roots go back further than that. Bentley was a surprise governor, winning office in 2011 despite the skepticism of the state’s political establishment. During his campaign, Bentley hired Rebekah Mason, a former TV newscaster, to work in his communications office. She remained with the governor after his victory, and though she was a political rookie, Mason soon accrued vast influence with the governor. Her husband also got a job on Bentley’s staff.

Some of Bentley’s friends became alarmed at Mason’s sway over the governor. Meanwhile, Bentley’s wife of nearly a half century thought she noticed him behaving strangely. In 2014, as Jason Zengerle reported in GQ, Dianne Bentley sprung a trap on her husband while on a trip to the beach, leaving her cell phone behind and recording as she went for a walk. The recording captured Bentley calling Mason. He told her he loved her, and indulged in some awkward almost-dirty talk: “When I stand behind you and I put my arms around you, and I put my hands on your breasts, and I put my hands on you and pull you in real close, hey, I love that, too.”

Despite family confrontations on both the Bentley and Mason sides of the family, the apparent affair—Bentley denied there was ever a physical relationship—stayed a secret. In August 2014, Spencer Collier, the head of the state law enforcement agency, and the head of Bentley’s security detail confronted him and told him he had to break off the relationship. Bentley agreed, but then changed his mind and decided to continue. With the secret open in his office and family, Bentley seemed more empowered to just continue things, Zengerle wrote. That fall, Bentley was reelected. In 2015, Dianne Bentley filed for and was granted divorce.

In March 2016, however, Bentley fired Spencer Collier, saying he’d misused state funds. Collier responded by pulling the curtain back on the whole affair, accusing the governor of an inappropriate relationship and mentioning the existence of Dianne Bentley’s secret tape. Days later, the tape itself leaked.

Incredibly, Bentley held on for more than a year. He wasn’t the only big scandal going on in the Yellowhammer state—the speaker of the state house was under investigation, and the chief justice of the state supreme court, the controversial Roy Moore, was on his way to his second removal from office. The Alabama House Judiciary Committee began an impeachment inquiry, but the investigation was put on hold in November when Alabama Attorney General Luther Strange requested that they halt it while he looked into the matter, but he never confirmed he was investigating Bentley.

The delicate equilibrium fell apart in February, when U.S. Senator Jeff Sessions was confirmed as President Trump’s attorney general, creating a vacancy for one of the state’s two Senate seats. Bentley appointed Strange to fill the job. Some critics saw this as political manipulation on the governor’s part: He could deftly remove the man with possible control over his fate by giving him an exalted office.

If that was the goal, it didn’t work. Steven Marshall, whom Bentley appointed as the new attorney general, promptly confirmed the investigation that Strange had refused to confirm, with an announcement that Marshall would recuse himself.

The proximate cause of Bentley’s downfall was not sexual misconduct itself. Following the old saw that the coverup is always worse than the crime, Bentley is accused to misusing state resources to try to hide his relationship with Mason, including using law-enforcement muscle to try to prevent the release of the tapes. The impeachment report released last week also lit into Bentley for being uncooperative. (The report lays out plenty of the semi-lurid details, at great length—more teen puppy love than X-rated.)

At the county courthouse on Monday, Bentley had to post $300 bond for each of his charges. The cash hit was just one more pice for the governor in a scandal that also cost him his marriage, his reputation, and his job.