WASHINGTON (Reuters) - Wells Fargo & Co WFC.N has agreed to pay $3 billion to resolve criminal and civil probes into fraudulent sales practices and has admitted to pressuring employees in a fake-accounts scandal, U.S. officials said on Friday, wrapping up one of the last major investigations looming over the bank.

Wells Fargo will pay the penalties to the U.S. Justice Department and Securities and Exchange Commission and enter into a three-year deferred prosecution agreement during which the San Francisco-based bank will continue to cooperate with any ongoing government investigations, Justice Department officials said.

As part of the deal, Wells Fargo admitted that between 2002 and 2016 it pressured employees to meet “unrealistic sales goals that led thousands of employees to provide millions of accounts or products to customers under false pretenses or without consent, often by creating false records or misusing customers’ identities,” the department said in a statement.

In a statement, Charles Scharf, Wells Fargo’s new chief executive, described the past conduct as “reprehensible.” Wells Fargo is the fourth-largest U.S. lender.

“This case illustrates a complete failure of leadership at multiple levels within the bank. Simply put, Wells Fargo traded its hard-earned reputation for short-term profits, and harmed untold numbers of customers along the way,” Nick Hanna, U.S. attorney for the Central District of California, said in a statement.

Top managers within Wells Fargo’s Community Bank division were aware of the “unlawful and unethical” practices as early as 2002, and many of the practices were referred to as “gaming” within the bank, the Justice Department said.

The agreement resolves the civil and criminal liability regarding Wells Fargo’s fake-accounts scandal.

About $500 million of the penalties will go to the SEC to be distributed to investors to settle charges that the bank committed fraud by misleading investors about its sales practices, an SEC official said on a call with reporters about the resolutions settlement.

Settling the multi-agency investigation marked an important milestone for Scharf, who joined the company from BNY Mellon in September shortly after the third anniversary of the scandal.

“We are committing all necessary resources to ensure that nothing like this happens again, while also driving Wells Fargo forward,” Scharf said.

‘GHOST IN A MACHINE’

Watchdog group Public Citizen criticized the deal, saying it does not go far enough.

“Any resolution for Wells Fargo’s massive, management-directed misconduct must hold individuals to account. We know many of the crimes, and we know that real executives, not some ghost in a machine, committed them,” said Bartlett Naylor, a financial policy advocate with the Washington-based group.

FILE PHOTO: A Wells Fargo logo is seen in New York City, U.S. January 10, 2017. REUTERS/Stephanie Keith

The deal does not preclude civil or criminal charges against individuals, Justice Department officials told reporters.

U.S. Senator Elizabeth Warren, who is seeking the Democratic nomination to challenge Republican President Donald Trump in the Nov. 3 election, wrote on Twitter, “This is a small step in the right direction, but it’s not a substitute for holding senior executives individually accountable - and bringing criminal charges against them if the evidence justifies it.”

The probe examined activities in Wells Fargo’s community bank unit, with Justice Department citing pressure coming from the division’s leadership.

In a rare move last month, a U.S. bank regulator charged several former Wells Fargo executives for their roles in the scandal. That included a settlement with former CEO John Stumpf and civil charges against Carrie Tolstedt, former head of the community bank unit.

“Ms. Tolstedt acted appropriately and in good faith at all times, and the effort to scapegoat her is both unfair and unfounded,” her lawyer Enu Mainigi said on Friday.

The Justice Department inquiry was seen by analysts and investors as a key hurdle the bank had to clear before it could focus on its growth strategy, which includes convincing the Federal Reserve to remove an unprecedented growth restriction placed on Wells Fargo’s balance sheet until it proves it has fixed its risk management and controls.

Wells Fargo had already paid out more than $4 billion in fines and penalties related to the scandal since 2016. Internal and external probes have uncovered issues in each of Wells Fargo’s major business lines, including wealth management and the commercial bank.

The U.S. House of Representatives Financial Services Committee is scheduled to hold three hearings on Wells Fargo’s conduct next month.

Over the past three years, Wells Fargo has taken various steps to fix its issues and rebuild trust with customers, investors and regulators. They include changes to its board, centralizing risk teams and hiring an external chief executive. However, ongoing reputation issues and unresolved legal matters have weighed on the bank’s stock price and profitability, which have lagged peers since 2016.