LOS ANGELES (AP) — A federal judge on Monday issued a sweeping ban on the U.S. government revoking deportation protection of immigrants brought to the United States illegally as children.

U.S. District Court Judge Philip Gutierrez expanded a preliminary injunction he issued earlier in a lawsuit that alleges the Trump administration is yanking people out of the Deferred Action for Childhood Arrivals program without giving them a chance to defend themselves.

The Obama-era program allowed such immigrants to live and work in the U.S. under certain conditions unless they commit serious or repeated crimes.

The American Civil Liberties Union lawsuit alleges that in many cases, the government ended immigrants' DACA participation even though they were never convicted of any serious crimes. They lost work permits and faced deportation proceedings.

For example, the suit contends 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.

ACLU attorneys said at least 22 people had their participation in DACA terminated and hundreds may be affected.

Gutierrez granted the lawsuit class-action status, meaning it will cover DACA recipients who, after Jan. 19, 2017, had or will have their DACA status revoked.

The judge barred the government from revoking DACA status without providing previous notice and an explanation. Those who've already lost their DACA status must have it reinstated.

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.