LOS ANGELES—A federal judge on Monday said he may allow a nationwide class-action lawsuit to proceed alleging that the U.S. government has unfairly revoked work permits from immigrants without giving them a chance to defend themselves.

U.S. District Court Judge Philip Gutierrez said he might block the Trump administration from yanking the permits without notice from immigrants in the United States illegally who are covered by a program for people brought to the country as children.

Gutierrez said he had reached a tentative decision before lawyers for the American Civil Liberties Union and the U.S. government made arguments in his Los Angeles courtroom. He has yet to issue a final ruling.

The lawsuit alleges that the government unfairly ended immigrants' participation in the Obama-era program known as Deferred Action for Childhood Arrivals, in many cases after run-ins with law enforcement though they were never convicted of any serious crimes. They were placed in deportation proceedings and lost their work permits.

Gutierrez said he didn't see why the government would end immigrants' participation in the program if there wasn't enough evidence to prosecute them for a crime. He also questioned how putting someone in deportation proceedings would justify doing so since they had to be in the country illegally to enter the program in the first place.

“You just say this person is an enforcement priority, based on, whatever,” he told the government lawyers.

The hearing came the same day the U.S. Supreme Court refused to take up the Trump administration's appeal of a court order requiring it to keep accepting DACA renewal applications during legal challenges over the program's fate.

The administration decided last year to phase out the program for hundreds of thousands of immigrants who were brought to the United States illegally as children or overstayed their visas.

ACLU attorneys said at least 22 people had their participation in DACA terminated and hundreds may be affected based on the government's estimates of revocations under the Trump administration.

The suit seeks to stop U.S. Citizenship and Immigration Services from revoking immigrants' work permits without giving them notice and to give immigrants a chance to respond.

For example, plaintiffs allege that Jesus Arreola had his work permit revoked after he was arrested on suspicion of immigrant smuggling, even though an immigration judge discredited the allegations when he testified he was a driver transporting passengers for a fare.

“If the government wants to change its position, it has to provide a reasoned explanation for doing so,” Jennifer Chang Newell, staff attorney for the ACLU's immigrants' rights project, told the court.

But Justice Department lawyers contend that government officials have discretion in these cases and that the immigrants whose permits were revoked were put into deportation proceedings after they were arrested.

“There's always been that caveat that it can be terminated any time, it's at the government's discretion,” James Walker, an attorney for the U.S. government.