Wells Fargo has agreed to pay $42 million to resolve allegations that it failed to maintain foreclosed homes in minority neighborhoods while putting more effort into upkeep of homes in primarily white areas.

The bank denied the allegations made last year by the National Fair Housing Alliance in a complaint with the Department of Housing and Urban Development. But it agreed to settle the case to resolve the dispute quickly, Wells Fargo spokesman Tom Goyda said in an e-mail Thursday.