A California federal judge ruled late Friday that the children of illegal immigrants be released immediately from secure detention centers, with their mothers if possible.

California U.S. District Judge Dolly Gee made a ruling in July that children held in family detention centers after crossing the U.S.-Mexico border illegally must be released rapidly, but the U.S. Department of Homeland Security asked her to reconsider her ruling, according to USA Today

Gee upheld her ruling Friday, saying that Homeland Security was in breach of a longstanding legal agreement stipulating that immigrant children cannot be held in secured facilities.

This ruling punctures holes in the Obama administration's immigration policies, and the wording makes it hard for Homeland Security to keep detainees, The Washington Times reported.

The stipulation that the mothers and children cannot be held in "secure" facilities makes it especially difficult, since all the facilities have to be secure.

Gee calls the government's latest arguments "repackaged and reheated" and said that the government still retains some latitude, particularly if the government declares that it's in the middle of a surge of illegal immigration.

The government has fears that the new order will indeed cause an upsurge in illegal immigration, but Gee denies its claims, calling them "speculative at best" and "fear mongering," according to Fox News.

Last year was considered a surge, with more than 60,000 unaccompanied minors and 60,000 more mothers with their children caught at the border. Their detention was meant to act as a deterrent to iligal immigration, ending in deportation. 

The government must adhere to the judge's orders by Oct. 23.