Wells Fargo CEO Tim Sloan greets members of Congress before testifying in front of the House Financial Services Committee earlier this month. (Erin Scott/Reuters)

Wells Fargo announced Thursday that its chief executive, Tim Sloan, is stepping down after he spent more than two years trying without success to convince lawmakers and regulators that the embattled bank is no longer a threat to its customers.

Sloan’s abrupt departure is likely to send shivers through Wall Street, which has faced increasing pressure to show that big banks have learned from the mistakes that caused the global financial crisis. As criticism of Wells Fargo has grown, Sen. Elizabeth Warren (D-Mass.) and other prominent Democrats have pointed to the San Francisco-based bank as an example of industry-wide problems.

Sloan spent more than two years on an countrywide apology tour after Wells Fargo acknowledged a pattern of consumer abuses — from opening millions of fraudulent accounts on behalf of its customers without their consent to mistakenly foreclosing on hundreds of clients and repossessing the cars of thousands of others. Sloan’s pleas often failed to win over frustrated lawmakers.

Making matters worse was the bank’s disclosure earlier this month in a regulatory filing that Sloan received $18.4 million in compensation in 2018, about a 5 percent bump from the previous year..

“About damn time. Tim Sloan should have been fired a long time ago,” Warren tweeted Thursday. “By the way, getting fired shouldn’t be the end of the story for Tim Sloan. He shouldn’t get a golden parachute. He should be investigated . . . And if he’s guilty of any crimes, he should be put in jail like anyone else.”

Sloan has earned more than $150 million in compensation since 2011, according to Equilar, a data firm that measures executive compensation. His retirement package will include outstanding stock worth more than $24 million, the firm said.

Sloan is stepping down as chief executive and president immediately and retiring from the company on June 30. C. Allen Parker, the bank’s general counsel, will take over as interim president and chief executive. The bank said it would begin the search for Sloan’s replacement this week.

The news is another stunning turn for the bank, which was once one of country’s most respected financial institutions. Less than a month ago, Wells Fargo officials denied reports that it had approached other top financial industry executives about Sloan’s job and that it remained confident in his turnaround plans. Sloan, a 31-year veteran of the company, took over as chief executive in 2016 after his predecessor, John Stumpf, stepped down amid growing criticism of the bank.

“It has become apparent to me that our ability to successfully move Wells Fargo forward from here will benefit from a new CEO and fresh perspectives,” Sloan said in a statement.

In a conference call with investors after the announcement, Sloan said it was his decision to step down and that he was not pressured by regulators or the company’s board.

Sloan’s latest challenge came earlier this month when he spent four hours before a House committee being scolded by lawmakers who said he had not done enough to address the bank’s years of misdeeds. Sloan told the committee that Wells Fargo had revamped its board, significantly increased its charitable giving and no longer emphasizes sales goals, which were blamed for many of the company’s problems. However, it did little to quiet criticism of the bank.

“The bottom line is that we’ve not seen the type of cultural or institutional change so desperately needed at Wells Fargo,” Rep. Patrick T. McHenry (N.C.), the ranking Republican on the House Financial Services Committee, said in a statement.

Sloan’s performance before the committee and the chilly reception from lawmakers caused some banking lobbyists to worry that Wells Fargo’s problems would continue to affect the rest of the industry. Even Wells Fargo’s regulators, typically loath to publicly criticize financial institutions, had become wary of the bank’s struggle to contain its problems. The Office of the Comptroller of the Currency recently said it was “disappointed” with Wells Fargo’s progress.

“What happened at Wells Fargo really was a remarkably widespread series of breakdowns really in their risk management apparatus, which resulted in significant consumer abuses,” Federal Reserve Chair Jerome H. Powell told lawmakers last week. “And as it’s gone on and on, it’s become clear that I think some time ago it became clear that these are deep problems that needed to be addressed in a fundamental kind of a way.”

Wells Fargo has paid billions in fines over the past few years but remains under investigation by the Securities and Exchange Commission as well as the Justice Department. Last year, the Consumer Financial Protection Bureau hit the bank with a $1 billion fine. The Federal Reserve also levied an unprecedented penalty against the bank, blocking its ability to expand. The bank has twice pushed back how long it would take it to be released from those restrictions.

“The mismanagement at Wells Fargo runs deeper than Mr. Sloan. The bank has a lot of work to do to fix its problems, and Congress and our bank watchdogs need to continue pressing for change,” said Rep. Katie Porter (D-Calif.).

The company’s stock price rose more than 2 percent Thursday after the announcement.