SAN FRANCISCO — A federal judge on Friday blocked the Trump administration from ending temporary legal protections that have allowed more than 1 million Venezuelans and Haitians to live and work in the United States, ruling the revocations were arbitrary and beyond the Homeland Security secretary's authority.

U.S. District Judge Edward Chen's order preserves status for roughly 600,000 Venezuelans whose Temporary Protected Status or related authorizations had expired in April or were due to expire Sept. 10, and for about 500,000 Haitians. Chen wrote that the administration's actions would send people "back to conditions that are so dangerous that even the State Department advises against travel to their home countries," and that the revocations were taken in a manner and speed that violated the law.

Chen scolded Homeland Security Secretary Kristi Noem for rescinding protections that had been extended by the Biden administration and said presidential administrations have administered the program for 35 years "based on the best available information and in consultation with other agencies," a process that involves careful study and analysis. The judge found Noem's actions "arbitrary and capricious" and that she exceeded her statutory authority when she sought to vacate extensions granted by the previous administration.

The ruling follows a wave of litigation after the Trump administration moved to terminate Temporary Protected Status (TPS) and Humanitarian Parole designations for roughly 1.5 million people from multiple countries, prompting lawsuits by immigrant advocates across the country. TPS is a designation that can be granted by the Homeland Security secretary to people in the United States when conditions in their home countries — such as natural disaster, political instability or widespread violence — make return unsafe. Designations prevent holders from being deported and allow them to work.

Chen's order arrives after several earlier judicial twists in the case. In March, Chen temporarily paused the administration's plans to end TPS for Venezuelans. The U.S. Supreme Court in May reversed that pause without providing a rationale, a common practice in emergency appeals that did not resolve the underlying merits. A three-judge appeals panel recently sided with plaintiffs, saying the administration did not have the authority to vacate protection extensions granted by the prior administration.

Plaintiffs and immigrant advocates welcomed Chen's ruling Friday, though they cautioned that it may not help people who already have been removed. "In recent months, people have suffered unspeakable harm — including deportation and family separation — due to the Supreme Court greenlighting Secretary Noem’s discriminatory and harmful agenda," said Emi Maclean, senior staff attorney with the ACLU Foundation of Northern California. "That must end now."

The lawsuit's court filings include declarations detailing turmoil after the earlier legal decisions. One declaration described a Venezuelan restaurant hostess living in Indiana who was deported in July after an annual immigration check-in, leaving her husband to juggle work and childcare. Another recounted a FedEx employee who reported for his required check-in in June, was detained and later slept on a floor for about two weeks fearing deportation to a notorious foreign prison; his wife struggled to maintain the household on her earnings.

A DHS spokesperson, in an emailed statement included in court filings, described the program as having been "abused, exploited, and politicized as a de facto amnesty program" and criticized what the department called "unelected activist judges," saying they cannot thwart the public's desire for secure borders. The statement added that Secretary Noem would use every legal option to restore the department's determinations.

Venezuelans were initially granted protections amid mass political unrest, hyperinflation and food shortages that have pushed millions to flee. Haiti's TPS designation dates to the catastrophic 2010 earthquake that killed and wounded hundreds of thousands and left more than a million homeless; the country continues to face food insecurity and widespread gang violence. Haiti's designation had been set to expire in September but was extended until February under a separate court order from New York.

Chen noted that designations are typically granted for six, 12 or 18 months and can be extended when conditions remain dire. He found the secretary's unilateral action to revoke such extensions unprecedented in its speed and method.

The government is expected to appeal Chen's order. The case has generated renewed debate over how much discretion a secretary of Homeland Security has to terminate TPS and parole protections that were extended by prior administrations, and whether such decisions are subject to judicial review. Until higher courts resolve those legal questions, Chen's ruling will preserve status for the roughly 1.1 million individuals identified in the lawsuit and maintain their authorization to live and work in the United States.