In her ruling, Gee gives the Justice Department 90 days to show why it should not have to change its policies.

Peter Schey, one of the attorneys who brought the lawsuit and the executive director of the Center for Human Rights, told the Associated Press that federal officials "know they're in violation of the law."

House Democrats, including Democratic Leader Rep. Nancy Pelosi (D-Calif.), pushed Department of Homeland Security Secretary Jeh Johnson earlier this year to end its holding of illegal immigrant families in "jail-like" centers.

The department stepped up the detention of immigrant families amid an influx of 60,000 families arriving at the Mexican border.