After U.S. authorities detained a 12-year-old boy crossing the U.S.-Mexico border by himself in February, government contractors wrote in his file that he went from being calm and cooperative to showing signs of depression brought on by “being kept from his family,” which had entered the country before him, according to a new court case.

The boy’s condition deteriorated further in the care of shelters funded by the U.S. Office of Refugee Resettlement, which now holds over 2,000 children separated more forcefully from their parents under an abandoned policy of the Trump administration, the lawsuit alleges. He has been transferred to a psychiatric facility in Texas and placed on a regimen of antidepressants, it says, and the U.S. government is refusing to release him to an adult sister in Los Angeles, saying her home may not be suitable and that the boy is not yet “psychologically sound” for release.

The complaint, filed Friday in federal court in California, illustrates the difficulties the Trump administration faces in complying with a federal judge’s order to reunify all 2,000 children and their parents within a month. Many of those children — perhaps “hundreds,” the lawsuit estimates — are already caught up in a bureaucratic tangle of medical determinations and assessments of family members to which they could potentially be released. In several cases documented in the suit, those issues have taken a year or more to be resolved.

The lawsuit alleges that delays in releasing minors amount to violations of their constitutional rights.

“Basic due-process rights for these children are really being trampled on right now by the Trump administration,” said Leecia Welch, an attorney for the National Center for Youth Law, one of the groups that brought the case. “Child after child has told us the same story of being awaken at 4 a.m., and flown across the country to be detained without being told why, let alone a judicial determination as to why. What ORR is doing is saying it can incarcerate children and throw away the key for as long as it likes.”

The Department of Health and Human Services declined to comment.

But in court filings in a separate case, the federal government has asserted that it has the right and responsibility to have doctors at shelters administer drugs to minors when needed. It has relied largely on authority courts have said it has in emergency situations to do so. In May, the Justice Department also pushed back on allegations that it was moving too slowly in discharging children to sponsors, saying it has a responsibility to adequately review and vet the conditions immigrants will live in.

Welch said the Justice Department all but invited advocates for immigrant children to file the suit during a recent court exchange over whether the government has the authority to prescribe psychotropic medications and whether it is violating previous legal agreements to release children as quickly as possible.

“To the extent Plaintiffs wish to challenge the sufficiency of constitutionality of the process … they should do so in separate litigation,” the Justice Department wrote in a court filing in May.

The group bringing the suit includes the same core group of attorneys and advocacy organizations that filed a 1985 complaint that led to a landmark document called the Flores settlement.

That agreement ultimately forced the U.S. government to stop housing children in austere detention centers run by Border Patrol officers and to instead direct children to more shelter-like conditions with education and exercise facilities run by ORR, a division of the U.S. Department of Health and Human Services.

The new case, Lucas R. v Azar, for Alex Azar, current HHS secretary, claims the policies and practices of ORR are “causing grave harm to children detained for alleged civil violations” of crossing the border.

Lucas R. is the pseudonym that attorneys assigned to the 12-year-old from Guatemala detained in February.

The suit alleges the boy was placed in Hacienda del Sol, a shelter in Arizona run by the government contractor Southwest Key. When he arrived, the lawsuit says, staff noted that Lucas “appeared cooperative, calm, and alert, and showed ‘no behavioral concerns.’ ”

“As his confinement wore on, however, Lucas became depressed, fearing that ORR would never release him to his family,” the case alleges, and without seeking consent of his closest relative in the United States, the “ORR administered Lucas psychotropic drugs, ostensibly to control ‘moderate’ depression.”

Meanwhile, the boy’s adult sister, who lives in Los Angeles with her infant daughter, brother and a roommate, had applied to be his sponsor and take custody of him from Hacienda del Sol.

But when investigators arrived to inspect her apartment, a friend of the roommate was visiting, the suit alleges. Agents said everyone in the home, including the friend would have to be fingerprinted for Lucas to be released to his sister’s custody.

The friend’s roommate did not show up for fingerprinting, and ORR informed the sister that Lucas would not be released to her.

For Lucas, the situation was deteriorating, the lawsuit alleges. The medication Zoloft was causing him stomach pain, and he began refusing to take the antidepressant. That led to his transfer to Shiloh Treatment Center in Texas. At that facility, a doctor who has signed off on many recent treatment plans has been operating on an expired state license, according to the Center for Investigative Reporting.

The lawsuit says: “Shiloh personnel have now diagnosed Lucas with ‘major depressive disorder.’ Among Lucas’ ‘major stressors,’ Shiloh personnel identify his ‘[b]eing kept from family and in ORR custody.’ Shiloh staff have nonetheless told Lucas that ORR will not release him until Shiloh medical personnel declare him psychologically sound.”

In addition to the Center for Youth Law, other plaintiffs are the Center for Human Rights and Constitutional Law, University of California Davis School of Law Immigration Law Clinic, and Cooley LLP.

“We don’t know what process ORR is using currently to reunite these children with their families and what we’re seeing is that parents of children are going through the ringer trying to get their kids out of these detention facilities,” Welch said. “There is no reason to think it is going to get any better.”