NEW YORK (Reuters) - Young immigrants denied credit by Wells Fargo Bank because they are not permanent U.S. residents can sue the bank under a post-Civil War law barring discrimination on the basis of immigration status, a federal judge ruled.

FILE PHOTO - A Wells Fargo Bank is shown in Charlotte, North Carolina, U.S. on September 26, 2016. REUTERS/Mike Blake/File Photo

In a decision on Thursday, U.S. District Judge Maxine Chesney in San Francisco rejected Wells Fargo’s argument that lenders are permitted under a more recent federal anti-discrimination law to consider immigration status before granting loans.

Filed in January, the proposed class action accused Wells Fargo of denying student loans and credit cards to immigrants granted work permits under the 2012 Deferred Action for Childhood Arrivals (DACA) program enacted by former Democratic President Barack Obama.

The federal initiative allows immigrants who were brought to the United State without documents as children to temporarily avoid deportation and work in the United States. Republican President Donald Trump, who criticized the program during his campaign, has not taken any action to end it since taking office.

The decision “reaffirms the right of noncitizens, including those with DACA status, to be offered credit on the same terms as U.S. citizens,” said Michael Litrownik, a lawyer for the immigrants.

Wells Fargo spokesman Jason Vasquez said the decision is disappointing but “in no way suggests that the claims ultimately will prevail.”

The ruling is another blow to the U.S. bank, which was engulfed in a scandal last year after acknowledging that its workers opened millions of unauthorized accounts to meet sales goals.

The lawsuit was brought by the California League of United Latino Citizens, an advocacy group for Hispanic Americans. It was filed on behalf of University of California-Riverside student Mitzie Perez and other young adults denied credit because they are not U.S. citizens or permanent residents.

They sued under the Civil Rights Act of 1866, passed after the Civil War to bar discrimination against former slaves on the basis of race. It was amended in 1870 to bar discrimination against non-citizens.

In a bid to get the lawsuit dismissed in April, Wells Fargo said the lawsuit ignores the 1974 Equal Credit Opportunity Act and related regulations, which allow lenders to consider prospective borrowers’ immigration status.

The bank said loans to DACA recipients pose risks because those individuals have only temporary residency status.

Student loans and credit cards are usually not backed by collateral, and it can be impossible to collect if borrowers are removed from the country, Wells said.

The case is Mitzie Perez et al v Wells Fargo & Co, U.S. District Court, California Northern District.