(CNN) A year before the Trump administration's "zero-tolerance" policy resulted in more than 2,300 children being separated from their families at the border in a mere five-week period, a ninth-grader in McAllen, Texas, was taken from his mother.

He was riding in a car with friends last spring when the car was pulled over. The teenager, brought illegally to the country by his mother as a baby, was unable to show identification. Police called immigration officials, who arrested the boy and sent him to a shelter for unaccompanied migrant children.

John Doe 2, as he is referred to in current legal filings challenging his detainment, became one of thousands caught in a network of shelters and higher-security facilities that house undocumented minors, now gaining attention as newly separated children have been streaming in.

Immigration attorneys working directly with migrant children say some of these facilities provide the best care they can, given the circumstances. And a huge shelter in Brownsville, Texas, which opened its doors for a media tour last week, appeared to be clean and well-staffed at the time.

But John Doe 2 landed in a far more troubled corner of the system, according to a first-person sworn declaration in a current legal motion against the federal government for unlawful and inappropriate detainment of children. His account is one of dozens describing overloaded and secretive shelters, treatment centers and secure detention facilities for undocumented minors, which at their worst have allegedly been home to neglect, assault and other horrific abuse.

The allegations in these documents, as well as recent facility inspection reports and other lawsuits, range from unsanitary conditions and invasive monitoring of mail and phone calls to unair-conditioned rooms in hot Texas summers and dosing children with cocktails of psychotropic drugs disguised as vitamins. At one facility, children recounted being held down for forcible injections, which medical records show are powerful antipsychotics and sedatives.

This is the system the children who have been separated from their parents are entering. And, even after the executive order Donald Trump signed on Wednesday, presented as a way to end the separation of migrant families, it is the system in which the children already separated and thousands of other undocumented children currently remain.

"There seems to be a level of cruel intent I've never seen before and a real indifference to the well-being of a child," said Holly Cooper, one of the many attorneys challenging the government's detainment of minors. Cooper regularly visits facilities and represents a number of migrant children as co-director of the Immigration Law Clinic at University of California, Davis.

The Office of Refugee Resettlement did not respond to repeated requests for information, and a spokesperson said the agency can't comment on ongoing litigation. But in a press call, officials said that shelters are run by organizations that meet state licensing standards and are staffed by people who are well-equipped to meet the needs of children in their care. The agency also said it is ready to expand capacity as needed to meet the growing demand.

What should we investigate next? Email Blake Ellis and Melanie Hicken

John Doe 2 tells another side of the story. When he tried to run away from the first shelter he was placed in after two months and began acting out, including harming himself and getting into fights, he said he was moved twice -- ending up at a public regional detention center in Virginia, Shenandoah Valley Juvenile Center, intended for some of the most dangerous young migrant detainees.

He claims his case manager told him he was transferred there because of "behavioral issues." That assertion is backed up by legal filings from the facility, which say he had been diagnosed with conditions including ADHD, anxiety and intermittent explosive disorder.

His arrival there marked the last time he would breathe fresh air for months, the teenager said in a sworn legal statement in January. He was so upset about being there that he talked back and lashed out at staff, who he said he heard degrading him and other Hispanic children in English, not realizing that he could understand. His defiance led them to hurt and restrain him, he said.

"They will grab my hands and put them behind my back so I can't move. Sometimes they will use pens to poke me in the ribs, sometimes they grab my jaw with their hands," he said in his declaration. "They are bigger than me. Sometimes there will be three or four of them using force against me at the same time. The force used by staff has left bruises on my wrists, on my ribs, and on my shoulder. The doctor here gave me ibuprofen for the pain."

Immigrant children housed at Shenandoah Valley Juvenile Center have made grave claims of abuse.

At this same facility, he said, he was sometimes kept in handcuffs and then tied to a chair with a restraint placed over his face with holes so he could breathe. This punishment was described in at least five other declarations from children, including one who said he was left naked, strapped to the chair for more than two days.

In court documents, Shenandoah denied any assault of residents, but it acknowledged that staffers use confinement and restraints when residents fight one another or staff, and it said it uses an "emergency restraint chair" as a last resort for aggressive behavior. "When the emergency chair is utilized, residents are restrained by their arms, legs, and torso, and a spit mask is placed on the resident to prevent staff from being spit upon or bitten," the facility stated. In a statement to CNN, the organization said, "Shenandoah Valley Juvenile Center believes the allegations of the complaint to be without merit and looks forward to the opportunity to present evidence that will allow a jury to reach the same conclusion."

John Doe 2 was still in Shenandoah as recently as January, when he gave his declaration. "I'm frustrated about being locked up and I miss my family," he said.

On Thursday, in response to the allegations, Gov. Ralph Northam of Virginia announced an investigation of the Shenandoah facility.

The US government doles out around $1 billion to nonprofits and local government agencies each year to house and provide services for detained migrant children, in facilities that range from the repurposed Walmart in Brownsville, Texas, that CNN visited last week to juvenile detention centers. The facilities where they are held are often opaque, not publicizing their locations and blocking journalists or lawmakers from viewing the conditions.

Some children in the system crossed the border alone, often fleeing violence in their home countries. Others arrived with their families and were separated, even before the new policy. Still others, like John Doe 2, have lived in the United States for years but lack citizenship. Regardless of their origins, they all enter the same system.

Immigration attorneys are battling the federal government over the conditions in these facilities, arguing that a high-profile settlement reached in 1997 that dictates how children are treated within the system, known as the Flores agreement, has not been upheld. Some of the allegations precede the Trump administration. Recent filings contain hundreds of pages of firsthand statements detailing abuses from children, medical records, intake paperwork, as well as internal correspondence and debate between attorneys and the federal government. Another, separate class action lawsuit filed in federal court last fall accuses Shenandoah of "unconstitutional conditions that shock the conscience," a claim Shenandoah denies.

Currently, nearly 11,800 children are housed in more than 100 facilities across 17 different states, according to the Office of Refugee Resettlement, which is required to take custody of the children within 72 hours of their initial detainment by immigration authorities. With many of these already operating at capacity, the government has been scrambling to find additional beds for children.

It is unclear how many children are currently housed in facilities more restrictive than shelters, but ORR data cited in court filings shows that such facilities received more than 800 admissions in fiscal year 2017.

Experts opposing the child-separation policy, including the American Medical Association and the National Council of Juvenile and Family Court Judges, say that even briefly separating and detaining children has been shown to cause long-lasting harm to them.

But at some of these shelters and other facilities, the harm to these children goes far beyond the mere fact of being detained in the first place. Some of the least restrictive facilities have been cited by regulators for problems -- including those run by Southwest Key Programs and BCFS Health and Human Services, two of the largest government grant recipients. And when trauma may cause kids to act out, children can promptly be moved or "stepped up" to more restrictive facilities, where children and their attorneys say they are treated like prisoners. Ultimately, their fate may depend on the facility where the US government decides to place them.

In shelter system, hundreds of 'deficiencies'

Though the worst abuses in the immigrant child detention system have been alleged in higher-security facilities, even the shelters where children begin their stays have seen allegations of neglect, assault, verbal abuse and missing background checks for staff, in a system that is increasingly straining at its seams.

Take, for example, the 26 shelters and higher-security facilities run in Arizona, California and Texas by Austin-based Southwest Key Programs, the largest ORR shelter contractor. This nonprofit has received more than $955 million in federal funding over the past three fiscal years, according to online government spending data. Company CEO and President Juan Sanchez made at least $1.5 million in 2016, according to government filings. That would put him among the five highest-paid nonprofit CEOs in the country that year, according to Charity Watch.

Dr. Juan Sanchez, president and founder of Southwest Key Programs

As recently as early 2017, Southwest Key shelters were mostly under capacity -- enough so that the company laid off workers and closed some shelters in mid-2017. But most of Southwest Key's 16 Texas shelters now operate under month-to-month variances granted by the state to let them hold up to 150% of their original licensed capacity, including the Casa Padre shelter in Brownsville that CNN visited last week.

Those variances have come even as state inspectors have found more than 246 "deficiencies" at Southwest Key's facilities over the past three years. State reports cite at least three cases of under-supervised children harming themselves, including one with plastic cutlery and one by drinking rubbing alcohol. They have cited staff for drunkenness; shoving, using other physical force and belittling children; for keeping kids in unair-conditioned rooms in mid-July at a shelter in El Paso; and in one case for having an "inappropriate relationship" with a child. In one case in a San Benito shelter, "Staff did not take child to the bathroom when he requested and consequently child urinated on himself during class time."

Twenty-three citations involved improper medical treatment. Inspectors cited Southwest Key for giving kids the wrong medications; for failing to give them prescribed medications; for withholding medical care -- for example, making a child with a fractured wrist at the El Presidente shelter in Brownsville wait three days before seeing a doctor -- or inappropriate care, such as vaccinating a pregnant teen at the same shelter.

In all three years, Texas cited Southwest Key for failing to get timely background checks on staffers.

In California and Arizona, shelters are inspected much less frequently. Arizona, which has eight open Southwest Key facilities and three that have been closed, generally only inspects accredited Southwest Key or other ORR-contracted shelters in that state when it receives a complaint, said Arizona Department of Health Services spokeswoman Nicole Capone. One citation of four recorded in that state since 2015 was for improperly restraining children.

One former Southwest Key employee in that state called the lack of supervision problematic.

"The whole time I worked at Estrella del Norte, I saw maybe one person from ORR," and no one from Arizona's oversight agencies, said Antar Davidson, who spent four months as a youth care worker at Southwest Key's shelter in Tucson. He quit on June 12, because, he said, he thought the way Southwest Key operated "was very damaging to the children." He has been outspoken about his experience in the last week since going public in the Los Angeles Times about his concerns, including that low-paid, high-turnover staff was not well equipped to handle the recent surge in distressed children newly separated from their parents.

Antar Davidson

Southwest Key's communications director, Cindy Casares, said all employees receive at least 80 hours of classroom and on-the-job training. She said the company takes deficiencies seriously, carries out internal investigations, and disciplines, fires or retrains employees who violate policy. "Whenever there is a finding of any kind, a corrective action plan is developed and submitted to licensing and implemented in the programs," she said.

Other ORR shelter contractors have a history of violations as well. State officials who inspected shelters operated by San Antonio-based BCFS Health and Human Services cited that nonprofit in 2016 for housing children in substandard conditions that included moldy carpets, rusty bathrooms and exposed nails in a bed. Staff were accused of inappropriate relationships with children in care; of using physical force and, in one case, an employee was found to have kept money sent to a child. This nonprofit will receive roughly $127 million in this fiscal year, according to online government spending data. BCFS could not be reached by phone, and a press release on its website referred all media inquiries to the federal government.

JUST WATCHED Former shelter employee explains why he quit Replay More Videos ... MUST WATCH Former shelter employee explains why he quit 01:36

A nonprofit in Virginia, Youth for Tomorrow, has been the subject of state violations at a facility where it hosts migrant children, including findings that the facility hired people without the required education and experience, failed to conduct background checks, and didn't adequately supervise the children in its care. In one case in 2013, a facility neglected to call authorities when a staff member physically restrained a resident; the resident said he was hurt so badly that he couldn't swallow. In a statement to CNN, Youth for Tomorrow said the organization is in compliance with all state regulations and that the citations were "singular events" that "were satisfactorily resolved in a timely and appropriate manner" as required by regulators.

Another nonprofit operator, KidsPeace, has recently been cited by Pennsylvania regulators for its shelters' failure to include crucial information in children's medical records (such as attempted suicide), inappropriate monitoring of phone calls and mail to and from children and inadequate abuse training. KidsPeace said in a statement that it strictly adheres to state laws and that its mission is to "provide hope, help and healing to children in need of care, including those placed with us by the federal Office of Refugee Resettlement."

Alleged restraints, assaults and pills known as 'vitamins'

The vast majority of unaccompanied children are held in shelters, but for the hundreds that are escalated to more secure facilities, conditions can be far worse. It can also become even harder to get out.

These places include residential treatment centers for those with severe psychiatric or psychological issues and risk of self-harm, "staff secure facilities" for children who require close supervision, and secure facilities for those who pose a danger to themselves or others or have been charged with committing a crime.

The government says these are a last resort intended to meet the specialized needs of the children and protect others in shelter care. But attorneys suing the federal government argue that many of these children have been moved to these facilities without "the most rudimentary procedural fairness or transparency," which the government denies. Some kids, they assert, should not have been placed in these facilities in the first place. And attorneys say those who do have documented behavioral issues, which are common given the trauma that many of these children have experienced, are only seeing their problems exacerbated by the conditions they endure in these higher-level detention centers.

"While all detainees (adults as well as children) should be treated with dignity and respect, this is especially critical for children and youth because of their inherent vulnerabilities," Gregory Lewis, a psychologist who reviewed the declarations of a number of youth held at Shenandoah, including the Texas teenager, stated in a legal filing. "It is likely that many of these detained youth will never fully recover from their traumatic experiences prior to and during detention."

In the first-person accounts reviewed by CNN, children describe being moved from facility to facility all over the country, often by plane, after being deemed unfit to remain in the shelter where they were originally placed. In multiple declarations, youths describe being awoken in the middle of the night only to end up transported to a new facility -- with no explanation of why they are being moved or opportunity to fight their new placement. And once they are placed in these secure facilities, attorneys say it becomes increasingly difficult to reunite them with family, because their release is contingent on a number of requirements and high-level approvals.

One of the places some of the most troubled children are being sent is the nonprofit Shiloh Treatment Center, located on a rural patch of land in Manvel, Texas. Shiloh has been the subject of controversy for years, with the founder being forced to close a separate facility, Daystar Residential Treatment Center, after a troubling history of abuse and deaths, culminating in a child dying in what was ruled a homicide by asphyxiation due to physical restraint. A local congresswoman called for Shiloh's closure four years ago after the Houston Chronicle documented years of abuse there, yet the government continues to pay millions to the organization.

The Shiloh Treatment Center in Manvel, Texas

Children held at Shiloh have recounted in their legal declarations being held down for injections of drugs to calm them. A 13-year-old from El Salvador described an incident when, after he tried to run away, he was assaulted by staff -- causing him to faint and leaving him with bruises. Then, despite his objections, he was given an injection of a drug "to calm me down." "Before they gave me the injection, I was feeling dizzy and was still having a hard time breathing. I was in a lot of pain with bruises all over, and I did not want the injection," he said.

Many also say they were forced to take pills that staffers called "vitamins," which they say were given to them without their or their parents' consent. Medical records filed as evidence show children were being injected with sedatives and antipsychotics, and that many of the pills they were given were powerful and sometimes addictive psychotropic medications.

An 11-year-old referred to as Maricela in court records said she was taking 10 pills a day, in a statement from late last year, and that she didn't know what they were for. "When I take medicine, I do not have any mood," she said in Spanish. "It is disgusting. I do not like being on this many medications and I have suffered side effects including headaches, loss of appetite and nausea." She said she was afraid to refuse the medication, knowing that her stay at Shiloh could be extended. And she described living in constant fear of staff members after being pulled forcefully out of a bathroom and witnessing them pinning other residents down to receive injections.

"Today, one of the girls was upset and someone was trying to calm her down but then the teacher said don't talk to her, just give her a shot," she said. She had become so sad at Shiloh that she wanted to cut herself, she added, but she hadn't learned how to do it yet.

"I do not feel safe here," said Maricela, who has been moved to an unknown facility but remains detained, according to a nonprofit law firm involved with the Flores motion. "I would rather go back to Honduras and live on the streets than be at Shiloh."

Shiloh, which is licensed to accept children as young as 3 years old and is on track to take in more than $25 million in funding between the 2014 and 2018 fiscal years, according to current government data online, referred CNN to the US government, which wouldn't comment either. A government letter the plaintiffs filed as evidence shows that as of April, 26 children were being housed at Shiloh through the ORR program. In a legal response to the allegations of inappropriate drugging and abuse, officials said the state of Texas carefully monitors the facility for compliance with state laws and guidelines, including those governing the use of prescription medications; that the facility psychiatrists strive to use no more than four psychotropic medications at once; and that consent is required except in emergency situations, when the youth could harm themselves or others.

At Shenandoah Valley Juvenile Center, the facility in western Virginia where the Texas teen described being tied to a chair, other teenagers describe being violently restrained, beaten, and discriminated against for being Latino. The facility is facing a class action lawsuit alleging verbal and physical abuse, substandard care, excessive use of solitary confinement and other deficient conditions that result in suffering and even death.

In declarations about their experiences filed in both the class action and the Flores motion, detainees reported being stabbed with a pen, kept in handcuffs, taunted by staff and being deprived of clothing and mattresses. Shenandoah, which government data shows will have received nearly $20 million in funding between the 2014 and 2018 fiscal years, denied the assault of residents in legal filings and said that punitive measures were only used in extreme situations.

JUST WATCHED Immigrant teens allege abuse at Virginia facility Replay More Videos ... MUST WATCH Immigrant teens allege abuse at Virginia facility 02:40

Another former detainee -- who spent around three years in ORR custody, including about a year at Shenandoah -- remembered the restraint chair described by the Texas teen. "(Y)ou feel suffocated with the bag on," he said. "(T)hey don't do it in a nice way. They don't explain what they are doing: they just grab the left side of your head and they force it over you. You can't move to resist. The first thing that came to my head when they put it on me was, 'They are going to suffocate me. They are going to kill me.'"

As another child, this one a 15-year-old from Honduras who described being repeatedly assaulted by staff at Shenandoah, plainly stated: "I want us to be treated as human beings."

Teenagers in the Flores documents described other forms of mistreatment across the country in California at Yolo County Juvenile Detention Facility, another secure facility paid by the government to house migrant children. Multiple youth discuss the use of pepper spray, with one teen saying he had been sprayed seven times in his eyes.

One teenager, who fled Guatemala to escape an abusive father and forced child labor, had been in federal custody for almost two years when he gave a sworn declaration in November from Yolo, which he described as "a juvenile jail where we are kept in cells, forced to wear uniforms and treated like criminals."

"The detention center makes me feel like an animal," said the teen. "The conditions at the detention center are terrible." The government, in a letter filed as evidence, said the teenager had psychiatric and behavioral issues.

The facility's own chief probation officer, Brent Cardall, told the Yolo County Board of Supervisors that the detention center could not meet the mental health needs of many of the migrant teens and previously stated in court filings that the government had often failed to provide any corroboration of gang affiliation of some of the supposed gang members sent there. In April, Cardall proposed ending the program for unaccompanied children altogether, saying "it would be in the best interest of the county to terminate this federal contract and end the program." The county supervisors instead voted to discuss reducing the number of migrant children accepted into the facility and requiring youth to have documented reasons for being there.

Yolo, which received more than $6 million in government funding between fiscal years 2014 and 2017, is on track to bring in more than $5 million for the 2018 fiscal year, according to online government data. The county said in a statement to CNN that in the 10 years it has worked with ORR, it has provided all youth with "the care and services they need," though staff are negotiating an increase in funding to meet the teens' needs. County officials also said they are "gravely disturbed" by the forcible separation of families, that no newly separated children have been placed there, and that the county has the ability to reject the placement of youth in its facility if officials don't believe they belong there -- which they have done in the past.

"The county does not, and has no interest in, operating a de facto federal prison for forcibly separated youth," the statement said.

While the conditions and alleged abuse at Shiloh, Yolo and Shenandoah dominate many of these first-person accounts, allegations of mistreatment and prolonged detention at other "stepped-up" facilities have surfaced as well. These have included taunting and physical abuse by staff, punishing children who refuse to take their medication, and claiming complaints about treatment could jeopardize a child's immigration status.

One Honduran teenager, identified as Roberto F., described employees at a "staff secure" Southwest Key facility in Brownsville insulting him and other residents. "There, too, I watched as they grabbed the minors brutally, throwing them to the ground," he said in his statement.

Casares, Southwest Key's director of communications, said in an email that "Southwest Key has a no tolerance policy on abuse," and that any program director aware of such allegations would be required to suspend the employee and report them to the state, to law enforcement and to ORR.

How separated children are joining a troubled system

Government officials have given inconsistent accounts of the precise number of children split from their families since the start of the zero-tolerance policy was announced on May 7. Border Patrol spokesman Brian Hastings said that between May 5 and June 9, agents separated 2,342 children from parents who crossed illegally. That doesn't include minors arriving unaccompanied or minors who arrived at ports of entry with parents seeking asylum. Though government officials have denied they split up families there, the American Civil Liberties Union is suing Homeland Security on behalf of several asylum seekers whose children were taken after they presented themselves legally at ports of entry.

During a tour for reporters of the Casa Padre shelter on June 13, Southwest Key CEO and president Juan Sanchez said that less than 30% of the almost 1,500 boys there, ages 10 to 17, had been separated. On June 19, a Southwest Key spokeswoman said about 10% of the children in its 26 shelters had been separated from their parents. Martin Hinojosa, Southwest Key's director of compliance, noted that the proportion of children separated from their parents is rising.

JUST WATCHED What zero tolerance really looks like Replay More Videos ... MUST WATCH What zero tolerance really looks like 04:07

It's still unclear what the implications will be of Trump's new executive order, in which the President continued to blame Congress for his own administration's recent move to separate families. The executive order declares a goal "to detain alien families together throughout the pendency of criminal proceedings for improper entry or any removal or other immigration proceedings." It also declared that the attorney general should prioritize immigration proceedings for detained families.

The Office of Refugee Resettlement didn't respond to multiple requests for comment or for information about where the children taken from their parents so far are now being placed. But attorneys and advocates say they believe it's only a matter of time before some of these newly separated children wind up being moved to some of the higher-security detention and treatment facilities with the worst conditions -- exposing them to more harm and making it harder for them to reunite with their parents.

"That's a significant concern that we have," said Nithya Nathan-Pineau, director of the Detained Children's Program at the Capital Area Immigrants' Rights Coalition. It's only natural for kids in prolonged detention -- and ones who have been separated from their families after harrowing journeys from dangerous homelands -- to have emotional or behavioral challenges, she pointed out.

On the June 13 tour of the massive Casa Padre shelter, Southwest Key's Hinojosa said staffers there move quickly to send boys who demonstrate troublesome behavioral or mental-health issues to higher-security facilities.

"Not a lot of the children detained in El Paso remain in El Paso," said Melissa Lopez, executive director of Diocesan Migrant and Refugee Services in El Paso, Texas. She has dealt with cases of children who she says were wrongly labeled as gang members. Lawyers say such children are often targeted for higher-security placement.

"They often make allegations with little or no proof. They don't have to tell us on what basis the finding was made. ... Our clients don't speak English. They don't understand what's going on. When a child is incorrectly flagged as a gang member, there are serious repercussions for the child and added difficulty for us, as practitioners, in figuring out on what basis the finding was made," she said.

Elissa Steglich, a clinical professor at the University of Texas Immigration Clinic in Austin, said she's seen increasing numbers of children being taken from parents at the border in recent months, and that in almost all cases, "there's no child-welfare rationale to support it."

By separating children needlessly and placing them into a system that can add to the harms they're experiencing, she said, "We've ensured there will be lifelong damage to these children."

Do you have anything to share about facilities holding migrant children? Email us: watchdog@cnn.com.