After markets closed Friday, Wells Fargo (WFC -0.56%)  announced a significant milestone in its effort to put its troubled past behind it, agreeing to pay $3 billion and admit wrongdoing to settle criminal and civil investigations with the Department of Justice and the Securities and Exchange Commission.

The bank has been under regulatory scrutiny since 2013, when reports first surfaced that bank employees had been opening unneeded accounts for customers, ordering credit cards without customers' permission, and forging client signatures in order to meet sales quotas.

The scandal in 2016 cost Wells Fargo CEO John Stumpf his job, and his successor Tim Sloan stepped down in 2019. Wells Fargo is also operating under a Federal Reserve-imposed asset cap in place until the bank can show the Fed that it has cleaned up its act.

A banker meets with clients.

Image source: Getty Images.

In a statement announcing the settlement, current CEO Charlie Scharf called the bank's conduct in past years "reprehensible and wholly inconsistent with the values on which Wells Fargo was built." He noted that over the past three years the bank has not only overhauled management, but its board as well. And Wells Fargo has eliminated all product-based sales goals and implemented other policies to try to avoid similar issues in the future.

"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," Scharf said. "We are committing all necessary resources to ensure that nothing like this happens again, while also driving Wells Fargo forward."

As part of the agreement Wells Fargo admitted it collected improper fees and interest, harmed customer credit ratings, and unlawfully used customer information. The nation's fourth largest bank will avoid criminal prosecution as part of the agreement, but it has to continue to cooperate with investigators and comply with the terms of the agreement to avoid prosecution.

The $3 billion payment includes $500 million to be distributed by the SEC to investors.

The government can still go after individuals involved with the scandal. In January the Office of the Comptroller of the Currency, a bank regulator, said that Stumpf has been ordered to pay a $17.5 million fine and barred from working at a financial institution again.

Shares of Wells Fargo have been bogged down by the scandal and its aftermath, underperforming the S&P 500 by nearly 70 percentage points over the past five years.