FILE - In this Tuesday, Sept. 20, 2016, file photo, Wells Fargo CEO John Stumpf testifies on Capitol Hill in Washington, before the Senate Banking Committee. Wells Fargo’s embattled CEO Stumpf is out effective immediately, with President and Chief Operating Officer Tim Sloan taking over as the head of the one of the nation’s largest banks, the company announced Wednesday, Oct. 12, 2016. (AP Photo/Susan Walsh, File)
FILE - In this Tuesday, Sept. 20, 2016, file photo, Wells Fargo CEO John Stumpf testifies on Capitol Hill in Washington, before the Senate Banking Committee. Wells Fargo’s embattled CEO Stumpf is out effective immediately, with President and Chief Operating Officer Tim Sloan taking over as the head of the one of the nation’s largest banks, the company announced Wednesday, Oct. 12, 2016. (AP Photo/Susan Walsh, File)

Wells Fargo announced on Wednesday that its longtime chief executive and chairman, John Stumpf, is stepping down, the latest turn for the embattled megabank after it admitted that thousands of low-level employees had set up sham accounts to meet sales quotas.

Stumpf’s sudden downfall will probably send shivers through Wall Street where a well-honed playbook for surviving public scandals appears to have been torn to pieces, upended by the type of populist anger that has fueled the rise of Republican Donald Trump and Sen. Bernie Sanders, of Vermont, on this year’s presidential campaign trail.

The San Francisco-based bank has repeatedly apologized and said it had fired 5,300 employees for misconduct and put in place more stringent internal controls. But that has not been enough for regulators and lawmakers, including Sen. Elizabeth Warren, D-Mass., who called on him to resign. Stumpf went as far as pledging to give up $41 million in compensation to account for the scandal, but his overture did little to quiet critics.

“While I have been deeply committed and focused on managing the Company through this period, I have decided it is best for the Company that I step aside,” Stumpf said in a statement.

Tim Sloan, another longtime Wells Fargo executive, will take over Stumpf’s duties as CEO. A board member, Stephen Sanger, will serve as chairman, effectively dividing power that had previously been consolidated under Stumpf. Sanger is the former chief executive of General Mills.

Stumpf’s downfall began in early September when Wells Fargo was fined $185 million by regulators after it discovered that thousands of employees were setting up unauthorized accounts, including credit cards and checking accounts, customers had not requested. In some cases, the customers were charged various fees for accounts they did not know existed. In others, bank employees would take money from authorized accounts to gain credit for setting up fake ones.

The company initially attempted to play down the problem, noting that the 5,300 employees fired over five years totaled only a small portion of its workforce. But that just stoked lawmakers’ anger, and the scandal continued to grow. Federal prosecutors are now considering criminal or civil charges against the company; the Labor Department is investigating whether the bank illegally fired employees who reported the wrongdoing; and several cities and states, including California, have said they would temporarily stop business with the bank.

Stumpf will not receive a severance package as part of his retirement. But he has accumulated $137.1 million in company stock, deferred compensation and a pension, according to Equilar, a research firm. His departure is a stunning end to the career of one of the financial industry’s most storied executives. He developed a reputation as a community banker in a hypercompetitive world of exotic financial instruments and large market bets. Even as Wells Fargo’s assets crept toward $2 trillion under his leadership, making it one of the largest financial institutions in the country, Stumpf often recalled his upbringing as one of 11 children on a dairy and poultry farm to explain his philosophy for ethical banking.

That did not help him during two congressional hearings last month in which lawmakers pummeled him for hours over the scandal. Several lawmakers called for Stumpf to step down, others said he should be criminally prosecuted.