Wells Fargo, the nation's fourth-largest bank, agreed Friday to pay a $3 billion fine to settle a civil lawsuit and resolve a criminal prosecution filed by the Justice Department over its fake account scandal.

Under pressure to meet sales quotas, bank employees opened millions of savings and checking accounts in the names of actual customers, without their knowledge or consent. Since the fraud became public in 2016, the bank has faced a torrent of lawsuits. The scheme lasted more than a decade, Justice Department officials said, and was carried out by thousands of Wells Fargo employees.

“This settlement holds Wells Fargo accountable for tolerating fraudulent conduct that is remarkable both for its duration and scope and for its blatant disregard of customer private information," said Michael Granston of the Justice Department's Civil Division.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Department officials said the bank took several steps to conceal the accounts from customers, such as forging customer signatures and preventing other Wells Fargo employees from contacting customers during routine surveys about their accounts.

None of the money to be paid to the government under this settlement will go to compensate customers. But officials said Wells Fargo has separately made efforts to compensate victims for potential losses — such as fees they might have been charged or harm to their credit ratings, if any.

The Securities and Exchange Commission said $500 million of the settlement would be used to compensate investors who responded to the bank’s promotion of its “cross-sell” strategy — selling more products and services to existing customers.

"We take seriously the rights of customers, creditors, and investors, all of whom were harmed by this conduct, where the bank was making up sales activities to get a competitive advantage over its customers," a senior Justice Department official said.

As part of the settlement, Wells Fargo admitted that employees were pressured to sell large volumes of new products to existing customers as a way of generating more business, often with little regard for a customer's actual needs. Bank employees began calling the practice "gaming," and it included opening accounts without a customer's knowledge, issuing credit and debit cards, and moving money from existing accounts to the fraudulently opened ones.

As part of Friday's settlement, the Justice Department agreed not to criminally prosecute the bank during the three-year term of the agreement, provided that Wells Fargo continues to cooperate with government investigations.

The agreement was reached with the bank itself, not with any individuals responsible for the fraud. But last month, the bank's former chief executive, John Stumpf, was fined $17.5 million by the Office of the Comptroller of the Currency for his role in the scandal. Other former bank executives were hit with smaller fines.