A federal judge in the Southern District of New York is temporarily blocking the Trump administration from deporting migrants in New York without notice or a court hearing.

The 3-page ruling issued Wednesday night follows President Donald Trump's invocation of the 1798 "Alien Enemies Act" to deport alleged members of the Venezuelan Tren de Aragua gang, which the administration claimed was invading the United States.

The American Civil Liberties Union, the New York Civil Liberties Union and the Legal Aid Society challenged the attempt on behalf of clients in New York's Southern District, claiming the White House was ignoring bedrock principles of the American legal system, such as due process.

“The court in New York properly recognized that the right to judicial review is of no value without notice," said Lee Gelernt, deputy director of the ACLU’s Immigrants’ Rights Project and lead counsel on the case, in a statement. "The court was correct to block any more removals to a notorious foreign prison without due process."

Thousands of Venezuelans have fled economic deprivation, violence and political persecution in recent years, making up a significant swath of the wave of migrants that began arriving in New York City roughly three years ago. Under Trump, some suspected members of the Tren de Aragua gang were sent to Guantanamo Bay in Cuba, the site of a U.S. naval facility used to house suspected foreign terrorists.

Federal Judge Alvin Hellerstein cited a U.S. Supreme Court ruling earlier this week that said, "detainees held pursuant to the AEA are entitled to notice and an opportunity be heard."

The judge's ruling only applies to people within the Southern District's jurisdiction: Manhattan and the Bronx along with Westchester, Rockland, Putnam, Orange, Dutchess, and Sullivan counties.

The White House did not immediately respond to a request for comment.

The ruling is a temporary restraining order and all parties are due back in court on April 22, after filing responses to Wednesday's order.