For the second time in 2½ years, a chief executive of Wells Fargo & Co. resigned abruptly on Thursday as the scandal-ridden bank took another stab at putting its problems behind it.

Tim Sloan became chief executive in October 2016, succeeding John Stumpf after the company was hit with the first of what would become billions of dollars in penalties for having opened millions of bank accounts without customers' authorization.

Just two weeks ago, Wells Fargo awarded Sloan a 5 percent pay raise, to $18.4 million a year. But the response from lawmakers and financial analysts to Sloan's congressional testimony about the company's problems that same week was highly critical, and on Thursday, Wells Fargo Chairwoman Betsy Duke said his departure "will best position the company for success."

"About damn time," Sen. Elizabeth Warren of Massachusetts, a Democratic presidential candidate who has long slammed Wells Fargo, tweeted Thursday afternoon.

"Tim Sloan should have been fired a long time ago," said Warren, a career consumer activist and former special adviser to the federal Consumer Financial Protection Bureau. "He enabled Wells Fargo's massive fake accounts scam, got rich off it, & then helped cover it up. Now — let's make sure all the people hurt by Wells Fargo's scams get the relief they're owed."

Wells Fargo said Sloan, 58, would immediately relinquish his seat on the board of directors and step aside as chief executive and president. He will retire from company completely at the end of June, it said.

Duke said in a statement that Allen Parker, Wells Fargo's senior executive vice president and general counsel, would replace Sloan, but she made it clear that he wasn't a long-term solution, saying that "seeking someone from the outside is the most effective way to complete the transformation at Wells Fargo."

Before he joined Wells Fargo in 2017, Parker, 64, was the presiding partner of Cravath, Swaine & Moore, one of the country's most prominent law firms. His interim appointment comes at a time when Wells Fargo has revealed that it has paid billions of dollars in fines and other penalties and that it is operating under 14 separate consent decrees with regulators.

Many of the decrees are associated with the systematic creation of sham bank accounts and other shady practices, which led the Federal Reserve a little more than a year ago to place an unprecedented regulatory cap on the company's growth, citing "widespread consumer abuses."