Wells Fargo & Co. has agreed to pay $300 million to settle a lawsuit claiming it improperly charged customers for unneeded auto-collision protection insurance — and hid the practice from investors.

The deal was announced Tuesday by the law firm that sued the bank after a New York Times investigation revealed that about 274,000 customers were put into delinquency and almost 25,000 vehicles were wrongfully repossessed.

“While we disagree with the allegations in this case, we are pleased to have resolved this legacy issue,” a bank spokesperson said in a statement.

Wells Fargo stopped charging customers for the insurance but didn’t tell investors, according to a statement issued by Robbins Geller Rudman & Dowd LLP. The law firm filed a securities-fraud class action alleging that the bank’s stock traded at artificially inflated prices.

Wells Fargo disclosed in a regulatory filing that it had been aware of the problem since 2016, the year before the 2017 New York Times story, according to the statement.

Attorneys for the investors are now seeing court approval of the settlement.

“When companies conceal widespread abusive or unfair business practices that harm their customers, investors often get injured, as well,” Scott H. Saham, a lawyer representing the class, said in the statement.

The case is Purple Mountain Trust v. Wells Fargo & Company, 3:18-cv-03948, U.S. District court for the Northern District of California (San Francisco).