U.S. District Judge Emmet Sullivan ordered the Trump administration Wednesday to stop rapidly deporting unaccompanied minors who illegally cross the border amid the coronavirus pandemic

The emergency declaration — challenged by the American Civil Liberties Union, Texas Civil Rights Project, Center for Gender & Refugee Studies, and Oxfam — was invoked in March under the Public Health Service Act. 

The Trump administration used it to deport thousands of minors, arguing in court that it must do so during the pandemic to prevent infecting border agents.

CDC Director Robert Redfield wrote in an order that illegal immigrants must be immediately deported because they "pose a risk of further introducing or spreading COVID-19 into the United States while they are held in the congregate holding areas of [ports of entry] and Border Patrol stations at or near the border."

CHINESE 'CARTELS' QUIETLY OPERATING IN MEXICO, AIDING US DRUG CRISIS

But the groups challenging the order argue that the Trump administration has used the pandemic as a way to enforce more stringent immigration policy. 

"Today’s ruling is a critical step in halting the Trump administration’s unprecedented and illegal attempt to expel children under the thin guise of public health," ACLU attorney Lee Gelernt, the lead attorney in the case, said in a statement. "The administration’s order has already allowed for the rapid expulsion of more than 13,000 children in need of protection, who were legally entitled to apply for asylum."

MEXICAN PIRATES POSING GREATER RISK IN GULF OF MEXICO TO OIL WORKERS, TOURISTS

Before the Trump administration's March order, children who crossed the border alone were sent to government-operated shelters and could be released to family members or other sponsors while seeking asylum. 

Wednesday's ruling only applies to children who cross the border unaccompanied by an adult. It does not apply to nearly 200,000 people who were rapidly deported by the Trump administration during the pandemic, including individual adults and parents with kids. 

Sullivan also presided over the case of President Trump’s former national security adviser Michael T. Flynn

CLICK HERE TO GET THE FOX NEWS APP

After the Justice Department dropped charges against Flynn earlier this year, Sullivan said he would not rubber stamp the department's decision and would let outside groups weigh in first. 

The judge was described earlier this year in The New York Times as having a "reputation for fierce independence and low tolerance for government misconduct."

The Associated Press contributed to this report.