The Trump administration's effort to strip hundreds of thousands of Venezuelan and Haitian migrants of legal protections is unlawful, a U.S. judge says.

The ruling by District Judge Edward Chen sets aside the Department of Homeland Security's (DHS) attempt to end temporary protected status (TPS) for people from countries experiencing conditions that make it dangerous to return.

This decision will allow around 600,000 Venezuelans and 500,000 Haitians to continue living and working legally in the U.S. The DHS has indicated it will appeal the decision.

The TPS program was established by Congress in 1990 to give temporary protections for migrants from countries experiencing war and natural disasters.

In a 69-page decision, Judge Chen wrote that DHS Secretary Kristi Noem's action in revoking their protected status was not only unprecedented in the manner and speed in which it was taken, but also violates the law.

He said conditions in their home countries were so dangerous that even the State Department advises against travel.

A DHS spokesperson responded to the ruling, stating the program had been abused, exploited, and politicized as a de facto amnesty program while indicating the agency would assess its legal options.

There are about 600,000 migrants who have TPS from Venezuela, the largest country included in the program. Former President Joe Biden extended the program to include Haiti, Afghanistan, Cameroon, and Ukraine.

Judge Chen’s ruling highlights the ongoing uncertainty surrounding TPS and the Biden administration’s immigration policies.