MONTGOMERY, Ala. — Gov. Robert Bentley resigned Monday rather than face impeachment and pleaded guilty to two misdemeanor campaign violations that arose during an investigation of his alleged affair with a top aide.

In a remarkable fall, the mild-mannered 74-year-old Republican and one-time Baptist deacon stepped down as the sex-tinged scandal gathered force over the past few days. Legislators turned up the pressure by opening impeachment hearings Monday. Last week, the Alabama Ethics Commission cited evidence that Bentley broke state ethics and campaign laws and referred the matter to prosecutors.

“There’ve been times that I let you and our people down, and I’m sorry for that,” Bentley said in the old House chamber of Alabama’s Capitol after he pleaded guilty.

The violations were discovered during the investigation of his affair but were not directly related to it.

One misdemeanor charge against Bentley stemmed from a $50,000 loan he made to his campaign in November that investigators said he failed to report until January. State law says major contributions should be reported within a few days. The other charge stemmed from his use of campaign funds to pay nearly $9,000 in legal bills for his alleged mistress, Rebekah Mason, last year.

The plea agreement specified that Bentley must surrender campaign funds totaling nearly $37,000 within a week and perform 100 hours of community service as a physician. The dermatologist also cannot seek public office again.

Bentley’s successor is Lt. Gov. Kay Ivey, who becomes Alabama’s second female governor. The first was Lurleen Wallace, wife of segregationist and four-term Gov. George C. Wallace. She ran as a surrogate for her still-powerful husband in 1966 when he couldn’t seek re-election because of term limits. She won, but died in office in 1968.

Bentley said in his statement that he no longer wanted to subject his family and staff “to the consequences that my past actions have brought upon them.” His staff gave him a standing ovation as he entered and exited the old House chamber.