(Reuters) - Wells Fargo & Co said on Friday it received final approval from a district court in California to settle a $142 million class-action lawsuit, which compensates customers affected by a sales scandal related to phony bank accounts.

A Wells Fargo logo is seen at the SIBOS banking and financial conference in Toronto, Ontario, Canada October 19, 2017. Picture taken October 19, 2017. REUTERS/Chris Helgren

The settlement, in which Wells had received a preliminary approval in July last year, sets aside funds for compensating customers after the bank opened consumer or small business accounts, credit cards or lines of credit without their knowledge between 2002 and April 2017.

The United States’ fourth-biggest bank is dealing with the fallout of two years of investigations, agreeing in April to pay $1 billion to settle with regulators who say it forced auto insurance on hundreds of thousands and routinely hit homebuyers with excessive fees.

Last month, the bank also agreed to pay $480 million to resolve a securities fraud lawsuit filed with the District Court for the Northern District of California which alleged the bank made certain misstatements and omissions in disclosures related to its sales practices.

Chief Executive Officer Tim Sloan said Friday’s announcement was “a significant step forward in making things right for our customers and restoring trust all of Wells Fargo’s stakeholders.”

Customers have until July 7 to claim money.

Announcing the settlement with regulators in August, the bank also said that the mortgage and auto programs together ensnared more than 600,000 customers and would require nearly $300 million in refunds.

Analysts worry the scandal has hurt Wells Fargo both by distracting executives with investigations and lawsuits, and through its impact on the bank’s public image.

In February, the U.S. Federal Reserve imposed a consent order on Wells that restricted it to grow assets beyond the $1.95 trillion it had at the end of last year “until it sufficiently improves its governance and controls.”

Sloan, since then, has reassured shareholders numerous times that the bank was stable and “open for business”.

Employees have also sought to downplay the scandal’s impact on profitability or market share, and have said that few customers have left the bank.

Wells Fargo’s shares were up 0.3 percent at $54.92 on Friday.