A U.S. federal judge on Monday rejected the Trump administration’s request to allow long-term detention of illegal immigrant children. The ruling is seen as a legal setback for President Trump’s push to detain immigrant families taken into custody at U.S.-Mexico border.

In a ruling in federal court in California, Judge Dolly Gee turned down a U.S. Justice Department motion to modify a 1997 settlement to allow the government to keep underage migrants in detention alongside their parents.

The government asked Gee to suspend the Flores settlement's requirement that immigrant children be held only in facilities that meet state child welfare licensing regulations, so as to allow whole families to be detained together.

Gee said there was "no state licensing readily available for facilities that house both adults and children."

Hundreds rallied across the US and protested separation of migrant families.

The protests have since spread to New York City, Detroit, Los Angeles, San Diego and Chicago, among other cities, causing minor disruptions to immigration officials, and in some cases criticized as well meaning but misguided by immigrant rights groups.

The protests, which began last week in Portland, Oregon, were spurred by news and images of migrant children from Central America being separated from their parents after crossing the U.S. southern border under Trump’s “zero tolerance” immigration policy, organizers said.

President Donald Trump signed an executive order ending the practice of separating children from their families in detention centers for illegal immigrants. The order will likely be challenged in court, however.

The administration of President Donald Trump has faced fierce criticism for separating more than 2,000 children from their families in order to prosecute their parents for crossing the border from Mexico illegally. Trump backed down last week, signing an executive order to keep families together in detention during immigration proceedings.