MONTGOMERY, Ala. — Gov. Robert Bentley resigned Monday, his power and popularity diminished by a sex scandal that staggered the state, brought him to the brink of impeachment and prompted a series of criminal investigations.

Ellen Brooks, a special prosecutor, said Mr. Bentley quit in connection with a plea agreement on two misdemeanor charges: failing to file a major contribution report and knowingly converting campaign contributions to personal use. He pleaded guilty Monday afternoon.

It was a stunning downfall for the governor, a Republican who acknowledged in March 2016 that he had made sexually charged remarks to his senior political adviser, Rebekah Caldwell Mason.

“I have decided it is time for me to step down as Alabama’s governor,” Mr. Bentley said at the State Capitol. He did not mention the charges to which he pleaded guilty, or the deal with prosecutors that mandated his resignation.

His exit from government and guilty pleas followed mounting calls for his resignation, especially after a report that was made public on Friday said he had fostered “an atmosphere of intimidation” and compelled state employees to help him cover up his relationship with Ms. Mason. Impeachment hearings — the first in Alabama in more than a century — began Monday morning, when the State House was consumed by rumors that the governor would soon quit.

Lt. Gov. Kay Ivey succeeded Mr. Bentley. A former state treasurer, she is the second woman to hold the office. She is a graduate of Auburn University and was a high school teacher and a bank officer before working for the Legislature.

“The Ivey administration will be open, it will be transparent and it will be honest,” Ms. Ivey said.

Mr. Bentley, 74, repeatedly denied having a physical relationship with Ms. Mason and long insisted that he had not broken any laws, but he was a subject of multiple investigations, including reviews by the F.B.I. and the Alabama attorney general’s office.

On Wednesday, the Alabama Ethics Commission said it had probable cause to find that Mr. Bentley had committed felonies, and it asked a district attorney to consider prosecuting him. Two days later, a lawyer hired by the Alabama House of Representatives released a report portraying Mr. Bentley as deceitful and desperate before his relationship with Ms. Mason made him a punch line.

The 131-page report said Mr. Bentley had offered little cooperation to legislative investigators, and it alleged that the governor’s critics had been subjected to coercion, including harassing messages and the threat of prosecution. The report described how Mr. Bentley tried to use a member of his security detail to break up with Ms. Mason on his behalf and how he demanded that Ms. Mason be allowed to travel in official vehicles after she left the state’s payroll.

It also explored Mr. Bentley’s efforts to keep audio recordings of suggestive conversations with Ms. Mason from the public. In one such conversation, which rippled across the internet last year, the governor described embracing Ms. Mason and placing his hands on her breasts.

By the weekend, legislative leaders had demanded that the governor quit, echoing a faction of rank-and-file members in his own party who spent months vocally opposing him. On Sunday night, the steering committee of the Alabama Republican Party made a similar call. And by sunset Monday, Mr. Bentley was out of power.

In court documents, the Alabama attorney general’s office said Mr. Bentley had failed to disclose a $50,000 personal loan to his campaign account. The office also said Mr. Bentley had allowed nearly $9,000 of campaign money to be used for Ms. Mason’s lawyers.

Mr. Bentley was sentenced to a suspended jail term, fined $7,000, placed on probation and ordered to complete community service. In an email on Monday, Ms. Mason declined to comment.

Yet until Mr. Bentley’s court appearance, it was unclear that he would actually abandon the job to which he was easily re-elected in 2014. Hours before the special counsel’s report became public on Friday, Mr. Bentley repeated his familiar pledge not to resign, and he pleaded for an end to the debate that stemmed from his personal conduct.

“The people of this state have never asked to be told of or shown the intimate and embarrassing details of my personal life and my personal struggles,” the governor said outside the Capitol. “Those who are taking pleasure in humiliating and in shaming me, shaming my family, shaming my friends, well, I really don’t understand why they want to do that.”

Within days, Mr. Bentley resigned. The decision punctuated a sordid drama that exploded last year, prompting renewed scrutiny of his 2015 divorce from Dianne Bentley, his wife of 50 years.

Mr. Bentley’s complaints and apologies over more than a year did little to quell public outrage in Alabama, where he had cultivated a reputation as an ethically sound public official. Now, he is the first Alabama governor to quit since 1837, when Clement Comer Clay left Montgomery to become a United States senator. (In 1993, Guy Hunt was automatically removed from office after being convicted of an ethics charge; he was later pardoned.)

Mr. Bentley’s resignation is the third major transfer of power in Alabama government since June, when the House speaker, Michael G. Hubbard, was convicted of ethics charges and forced from office. Later in the year, Chief Justice Roy S. Moore was suspended for the balance of his term for violating judicial ethics standards.

Mr. Bentley, a dermatologist, was a legislative backbencher until he stunned Alabama with his successful campaign for governor in 2010. In the early months of his tenure, he was widely praised for his response to a tornado outbreak that devastated much of the state. His policy legacy, at least among many Republicans, will be mixed. He opposed same-sex marriage and, within months of taking office, approved what was then one of the country’s most aggressive immigration laws. But he also called for higher taxes and, in 2015, surprised many people when he unilaterally ordered four Confederate flags lowered on the grounds of the State Capitol.

He also refused to endorse Donald J. Trump in the 2016 presidential campaign.

But Mr. Bentley’s personal conduct placed some of the greatest stress on his ties to members of his own party, and those conflicts worsened as he clung to power.

“It’s sad watching anyone fall,” State Representative Corey Harbison, a Republican, said Monday. “I hate that it all happened, but I’m thankful that the governor stepped aside. We can begin to put this behind us.”

Gov. Robert Bentley of Alabama before a news conference on Friday outside the State Capitol in Montgomery. He has said he did not break the law. Credit Albert Cesare/The Montgomery Advertiser, via Associated Press

Alabama 'Luv Guv' Robert Bentley quits over relationship with aide

Alabama's governor has quit over his relationship with an aide in one of the state's biggest political scandals.Robert Bentley, a two-term Republican, stepped down as lawmakers began impeachment proceedings against him.

The tawdry saga has seen his suggestive text and phone messages with a former adviser splashed across media.

The state ethics commission last week found reason to believe he had committed four felony crimes involving possible misuse of state funds.

Lieutenant Governor Kay Ivey, also a Republican, was sworn in to replace him shortly after his resignation.Mr Bentley, a 74-year-old former Baptist deacon and dermatologist, was last week defying calls to step down, including from leaders of his own party.

But a 3,000-page report on Friday from the Alabama House judiciary committee attorney said Mr Bentley had demanded state officials help him cover up an "inappropriate relationship".

He had also "encouraged an atmosphere of intimidation" to hide the scandal, according to the findings.Mr Bentley insisted his relationship with Rebekah Caldwell Mason, a former TV news reporter and married mother of three, was never physical.

But the report said security personnel had seen her "leaving the [governor's] office with her hair tousled and her clothing in disarray".

In texts between the governor and Mrs Mason, one from her phone said: "You handsome, wonderful, amazing, delicious, funny, sweet man."

Mr Bentley, who was first elected in 2010, replied: "You are wonderful my sweet love. I love you."

In another exchange, the two discussed their desire to elope.

According to the findings, the governor also mistakenly sent his wife, Dianne Bentley, a text message that said, "I love you Rebekah".

In March 2014 Mrs Bentley secretly recorded an explicit phone conversation between her husband and a woman he addressed as Rebekah.

"When I stand behind you," he is heard saying in a recording that was leaked to local media, "and I put my arms around you, and I put my hands on your breasts, and I put my hands (unintelligible) and just pull you real close. I love that, too."

Mrs Bentley filed for divorce in August 2015, saying the 50-year marriage had suffered an irreparable breakdown.Mrs Mason, whose husband also worked for the governor, resigned in March last year as the scandal emerged.Mr Bentley's resignation does not draw a line under the scandal.

On Monday afternoon, he had his mugshot taken by Montgomery County Sheriff's Office on two misdemeanour charges of campaign finance violations linked to the alleged affair.

Alabama Gov. Robert Bentley resigns following allegations of using state resources to hide affair

Alabama Gov. Robert Bentley has resigned following allegations that he used state resources to cover up an affair he was having with one of his top aides.

Bentley, 74, was booked into a Montgomery County Jail Monday on charges of failing to file a major contribution report and knowingly converting campaign contributions to personal use, according to booking information on the Montgomery County Sheriff's Office website.

When asked if he was guilty at the Montgomery County Courthouse, Bentley responded, "Yes, sir."

Bentley signed a plea deal that requires him to reimburse the nearly $9,000 his campaign spent on the legal fees of former aide Rebekah Mason, with whom he is accused of having an affair. In addition, he must forfeit all the money in his campaign account -- which is in excess of $36,000 -- to the state.

The former governor will also be required to complete 100 hours of community service as a physician.As part of the plea deal, Bentley also agrees to not pursue elected office in the future. He must waive any retirement and other benefits to which he would otherwise be entitled as well.

During the announcement that he was resigning, Bentley said he received the "greatest honor" of his life when he was elected as governor of Alabama and apologized for letting the people of Alabama down.

"I want you to know, I love our people with all my heart, and I want nothing more than to serve them," he said. "The time has come for me to look at new ways to serve the great people of our great state. I have decided it is time for me to step down as Alabama's governor."

Bentley's last words as governor were: "So, thank you. Goodbye, and I love this state -- from the bottom of my heart."

Alabama lawmakers began impeachment hearings on Monday for the Republican governor, whose alleged indiscretions with Mason were detailed in a report by Jack Sharman, a veteran Birmingham-based lawyer.

"Governor Bentley directed law enforcement to advance his personal interests and, in a process characterized by increasing obsession and paranoia, subjected career law enforcement officers to tasks intended to protect his reputation," the report states.

Lt. Gov. Kay Ivey will replace Bentley as governor.

Although details of about the alleged affair have been circulating for over a year, the report, which was issued by the House Judiciary Committee of the Alabama House of Representatives, offers a more complete window into the alleged affair than had been previously rendered.

For example, the report states that Bentley sent his wife, Dianne, a text message that read "I love you Rebekah."

The alleged text was accompanied by a red rose emoji, according to the report.

GQ magazine reported that in 2014, Bentley's wife surreptitiously recorded him speaking to Mason on the phone in an intimate manner.

According to GQ's reporting, the text message with the rose emoji was sent a few weeks after the recording was made.

Dianne filed for divorce in 2015, according to the Montgomery Advertiser.

In a press conference last December, Bentley admitted making sexual comments to Mason and apologized to Alabama residents, but denied having an affair.

"Since that time I have apologized to members of my family, to Mrs. Mason and her family and I apologized then for any conversations and behavior then that was inappropriate," Bentley said, referring to allegations about his affair. "Today I want to apologize to the people of the state of Alabama and once again I want to apologize to my family. I am truly sorry and I accept full responsibility."

Bentley also denied doing anything that would warrant his removal at that time.

"I want everyone to know though that I have never had a physical affair with Mrs. Mason," he said. "I can assure the people of Alabama I have never done anything illegal. I have never asked any member of my staff or any cabinet member to lie."

Mason, for her part, resigned from her post in March of 2016, which was announced through a statement issued by Bentley's press office. "I have resigned as Senior Political Advisor to Governor Bentley and will no longer be paid from his campaign fund," the statement said.

"My only plans are to focus my full attention on my precious children and my husband who I love dearly," it continued. "They are the most important people in my life. Thank you for your prayers for our family."

Jon Mason, her husband, who, according to ABC affiliate WBMA, works as the director of the Governor’s Office of Faith-based and Volunteer Service, released a statement about the allegations on his Facebook page.

“I wanted to share that I long ago resolved the personal issue playing out now for everyone this week. Please continue to support families, the governor, and our state with prayers as we all move forward,” he wrote.

Jon Mason also referred to his wife a “child of God.”

The report also alleges other potentially embarrassing details, including an incident that occurred during a 2014 trip to Washington, D.C., in which the septuagenarian apparently opened the hotel room door while wearing only his boxer shorts, expecting Mason to be on the other side of it.

Bentley's alleged affair with Rebekah Mason also became apparent to members of his staff and he started calling his Mason "baby" during meetings.

"Over time, the nature of the Bentley-Mason relationship also became more obvious to the Governor’s staff," the report said. "Zach Lee reported to Heather Hannah during the re-election campaign that Governor Bentley had begun to call Rebekah Mason 'baby' in meetings and that Governor Bentley and Mason frequently went to lunch together by themselves."

Zach Lee is Alabama's director of Federal & Local Government Affairs, according to a government website.