U.S. financial giant Wells Fargo & Co. is paying $3 billion (all figures U.S. dollars) to settle charges stemming from its practice of opening millions of fake accounts for customers.

The U.S. Securities and Exchange Commission (SEC) charged Wells Fargo with misleading investors about its cross-selling strategy when it was actually opening fake accounts and selling unnecessary products to clients.

The bank agreed to pay $500 million, which will be returned to investors, to settle the SEC’s charges. The $500 million is part of a combined $3 billion settlement with the SEC and the Department of Justice.

“Wells Fargo repeatedly misled investors, including through a misleading performance metric, about what it claimed to be the cornerstone of its community bank business model and its ability to grow revenue and earnings,” said Stephanie Avakian, co-director of the SEC’s enforcement division, in a statement.

“This settlement holds Wells Fargo responsible for its fraud and furthers the SEC’s goal of returning funds to harmed investors,” she added.

The bank also entered into a deferred prosecution agreement with the U.S. Department of Justice (DoJ) that acknowledges its criminal conduct. Under the agreement, no charges will be filed against the bank.

“While today’s announcement is a significant step in bringing this chapter to a close, there’s still more work we must do to rebuild the trust we lost. We are committing all necessary resources to ensure that nothing like this happens again, while also driving Wells Fargo forward,” said Charlie Scharf, CEO of Wells Fargo, in a statement.