Wells Fargo offices in Oakland, Calif. (Ben Margot/AP)

Wells Fargo said Friday that it faces a potential $1 billion in fines to resolve government investigations into the megabank’s behavior in the auto and mortgage markets.

The bank has acknowledged that it charged thousands of customers for auto insurance they didn’t need, driving some to default on their loans and lose their cars through repossession. The bank has also said it will refund customers who were charged improper fees to lock in an interest rate for a Wells Fargo mortgage.

Both matters have been under investigation for months by two federal regulators, the Consumer Financial Protection Bureau and the Office of the Comptroller of the Currency. Those regulators are offering to resolve the matter for a combined $1 billion, the bank said. Such a large civil penalty would be the latest hit to Wells Fargo’s effort to rebuild its image after more than a year of scandal.

“I’m confident that we’re on the right path with the transformational changes we are making,” Tim Sloan, the bank’s chief executive, said in a conference call with analysts on Friday. “We have more work to do, and it will take time to put all of our challenges behind us, but the result will be a better Wells Fargo for all of our stakeholders.”

San Francisco-based Wells Fargo has been struggling to rebuild its reputation since acknowledging in 2016 that it had opened millions of sham accounts customers didn’t want. Its longtime chief executive resigned, and Wells Fargo paid millions of dollars in fines and overhauled its board of directors. Last month, the Federal Reserve levied an unprecedented penalty against the bank, blocking its ability to expand.

The bank also faced pushback from some lawmakers after it awarded Sloan, who took over as chief executive in the midst of the running scandals, an $17.4 million pay package last year. That was a bump up from about $13 million in 2016, when he took the job.

The bank takes all of its regulatory issues “very, very seriously,” Sloan said, and has made progress in addressing those issues. “But in terms of declaring victory and walking ahead, we’re not quite there yet.”

Despite grappling with a potentially massive fine, Wells Fargo on Friday reported a surge in its business during the first quarter. Profits jumped to $5.9 billion during the first three months of this year, compared with $5.6 billion in the same period last year. Revenue fell slightly to $21.9 billion, compared with $22.3 billion last year.

Wells and several other big banks reported that the new, lower corporate tax rate and rising interest rates were helping boost their bottom lines.

JPMorgan Chase, for example, reported that its revenue hit record highs during the first quarter. The bank’s revenue rose about 10 percent to $28 billion. Profit reached $8.7 billion, up 35 percent from $6.5 billion during the same period last year. This came as JPMorgan’s  effective income tax rate fell to 18.3 percent in the first quarter, compared with 22.7 percent last year.

The year “is off to a good start with our businesses performing well across the board,” Jamie Dimon, the bank’s chief executive, said in a statement. “The global economy continues to do well, and we remain optimistic about the positive impact of tax reform in the U.S.”

The recent volatility in the stock market, which has fallen, then risen hundreds of points on some days, has also helped boost banks’ profits.

Citigroup reported that quarterly profit jumped 13 percent to $4.6 billion, the highest it’s been in three years, while revenue was up 2.8 percent to $18.9 billion. This came as the bank’s revenue from its stock trading business rose 38 percent to $1.1 billion.

“While market conditions have been uneven so far this year, our first-quarter results show our ability to deliver for both clients and shareholders and we look forward to sustaining this momentum for the balance of the year,” Citigroup chief executive Michael Corbat said in a statement.

Despite the strong results, JPMorgan and Citi’s stock price fell about 2.7 percent and 1.5 percent on Friday. Wells Fargo was down about 3 percent.