Border Patrol agents take a father and son from Honduras into custody last month near Mission, Texas.
CNN  — 

The decades-old settlement agreement Flores v. Reno has made headlines recently as the US government has taken heat for separating immigrant children from their parents. The agreement limits the length of time and conditions under which US officials can detain immigrant children.

On Monday, a federal judge in California rejected the Justice Department’s attempt to modify the agreement by asking for more time to detain children than the 20 days the agreement currently allows. The Trump administration also wanted the ability to hold children with their parents in Immigration and Customs Enforcement residential facilities, as opposed to the licensed facilities required by the settlement.

But the problem of separating and detaining immigrant children dates to long before President Donald Trump was elected.

The 1997 Flores settlement requires the government to release children from immigration detention without unnecessary delay to their parents, other adult relatives or licensed programs, Doris Meissner, director of the US immigration policy program at the Migration Policy Institute, told CNN in June. It also requires immigration officials to give detained minors a certain quality of life, including things such as food, drinking water, medical assistance in emergencies, toilets, sinks, temperature control, supervision and as much separation from unrelated adults as possible, according to a Congressional Research Service report.

During the 1980s, the former government agency Immigration and Naturalization Service was accused of mistreating immigrant children, according to the Congressional Research Service report, resulting in a series of lawsuits that ended with the Flores settlement agreement.

The agreement was named for Jenny Lisette Flores, a 15-year-old girl from El Salvador. She fled her country in 1985 and tried to enter the United States to be with her aunt. The INS arrested her at the border, and she was placed in a juvenile detention center, where she was handcuffed and strip-searched, according to the Marquette Law Review. The INS refused to grant her aunt custody of Jenny because it wouldn’t release minors to “third-party adults,” the law review article said. The American Civil Liberties Union filed a class-action suit on behalf of the girl and other minors, eventually leading to the Flores agreement during the Clinton administration.

For years, people criticized the INS, saying it hadn’t fully implemented the regulations laid out by the Flores agreement, according to the Congressional Research Service report.

Five years after the agreement, the Homeland Security Act of 2002 split up the responsibilities for processing and caring for immigrant children. Yet still, people worried that regulations were not being met. In 2008, Congress passed the William Wilberforce Trafficking Victims Protection Reauthorization Act. This codified parts of the settlement into federal law, Meissner said.

In 2015, US District Judge Dolly Gee ruled that Flores requirements apply to both unaccompanied minors and children apprehended with their parents. This means that all minors must be released from detention if possible, Meissner said.

Even so, the future of the immigrant children currently being detained is still unclear.

On Monday, Gee wrote that the Trump administration seeks to “hold minors in indefinite detention in unlicensed facilities, which would constitute a fundamental and material breach of the parties’ Agreement,” but she further explained that “all parties admit that these parents may also affirmatively waive their children’s rights to prompt release and placement in state-licensed facilities.”

Justice Department spokesman Devin O’Malley said in a statement that the Trump administration is working to protect the safety of children in government custody.

“We disagree with the court’s ruling declining to amend the Flores agreement to recognize the current crisis of families making the dangerous and unlawful journey across our southern border, but the court does appear to acknowledge that parents who cross the border will not be released and must choose between remaining in family custody with their children pending immigration proceedings or requesting separation from their children so the child may be placed with a sponsor,” O’Malley said. “The Justice Department continues to review the ruling.”