NEW YORK (AP) — Wells Fargo’s embattled CEO John Stumpf is stepping down as the nation’s second-largest bank is roiled by a scandal over its sales practices.

The San Francisco bank said Wednesday that Stumpf is retiring effective immediately and also relinquishing his title as chairman. It had earlier announced that Stumpf, the bank’s CEO since 2007, will forfeit $41 million in stock awards.

Wells Fargo’s chief operating officer, Tim Sloan, will succeed Stumpf as CEO and join the company’s board. Sloan has been with Wells Fargo for 29 years. Stephen Sanger, the bank’s lead director, will serve as the board’s non-executive chairman.

Stumpf’s end at Wells Fargo comes a little over a month after the bank was fined by California and federal regulators $185 million over its sales practices.

The regulators alleged employees trying to meet aggressive sales targets opened bank and credit card accounts, moved money between those accounts and even created fake email addresses to sign customers up for online banking — all without customer authorization. Debit cards were issued and activated, as well as PINs created, without customers’ knowledge.

Stumpf, a 34-year veteran of the bank, had previously gained acclaim for navigating Wells Fargo through the financial crisis and keeping it free of scandal. But he came under withering pressure over the alleged misconduct, believed to have gone on at the bank for years. Some 5,300 lower-level employees were fired.

“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,” he said in a prepared statement Wednesday.

Among Stumpf’s critics, Democratic Sen. Elizabeth Warren of Massachusetts told him at a Senate Banking Committee hearing last month that he should resign and “give back the money you took while the scam was going on.”

Stumpf earned $19.3 million last year. But he and Carrie Tolstedt, the executive who ran the retail banking division, will forfeit millions.

Tolstedt announced in July that she would retire from the bank this year and had been expected to leave with as much as $125 million in salary, stock options and other compensation. She was stripped of $19 million of her stock awards, and her departure was made immediate.

Before the scandal, Stumpf was lauded for Wells Fargo having avoided some of the bad behavior of its peers in the lead-up to the financial crisis. Wells Fargo didn’t invest in as many toxic mortgages as its counterparts, and Wells was actually able to grow significantly by buying Wachovia.

Until then a primarily West Coast and Southern bank, that gave the company known for its stagecoach logo access to the lucrative East Coast and New York banking markets.

The revelations have sparked investigations by federal agencies. The bank’s independent directors have also launched their own investigation.