CHARLOTTE, N.C. (AP) — Wells Fargo says a company mistake contributed to hundreds of foreclosures because it miscalculated customers' eligibility for mortgage modifications.

The bank said in a filing Friday the error caused about 625 customers to be denied, or not offered, loan modifications they otherwise qualified for. Foreclosures were completed in about 400 cases.

The customers had been using federal programs that helped families at risk of losing homes. A spokesman didn't immediately respond to a question about where the foreclosures were.

The error in the bank's underwriting tool lasted from 2010 until it was fixed in late 2015, an internal review found.

The bank said it set aside $8 million this year to help the affected customers.

With its main corporate office in San Francisco, the bank employs thousands in Charlotte.