In 2017, Jose Antonio Hernandez Vasquez, a 17-year-old from Guatemala seeking asylum in the United States, was suddenly moved from a youth shelter to a maximum-security facility in Southern California. For about 10 months, the teen was detained alongside adults, many of them gang members and convicted criminals, before authorities realized their error.

The mistake was made, Hernandez’s lawyers now argue, because of the federal government’s reliance on a controversial dental exam to determine the age of migrants — a practice they say can have legal and psychological consequences for youths who are seeking protection.

Hernandez, who is now 18 with a pending deportation case, argues that he should be released because the mistake deprived him of the legal options and representation he would have received as a minor.

“He only ended up in a maximum-security jail because of this junk-science dental scan,” Esther H. Sung, one of his lawyers, told The Washington Post. “Would you put your kid there? Of course you wouldn’t. We can all easily imagine how vulnerable a kid is in a facility full of adults.”

Officials at the departments of Homeland Security and Health and Human Services did not respond to messages about the case. Under federal law, these agencies aren’t supposed to use dental exams alone to determine a migrant’s age. But Hernandez’s attorneys say the agencies didn’t follow that rule, which critics allege is often broken, as reported last year by the news organization Reveal.

A migrant’s age can determine their fate in the United States after they apply for asylum. Historically, unaccompanied minors have been held in shelters run by the HHS’s Office of Refugee Resettlement, where they tend to enjoy greater freedom and better access to lawyers, while those 18 and older are sent to adult-detention facilities run by Immigration and Customs Enforcement.

Immigration officials say asylum seekers are sometimes untruthful about their age. On a call with reporters earlier this year, officials said they had identified 3,100 cases of migrants making fraudulent claims while seeking asylum, including some adults who claim to be children.

But lawyers say the practice of “forensic odontology,” as it’s formally known, has resulted in an increasing number of minors erroneously being kept in adult facilities.

Hernandez said that he was abandoned shortly after he was born by his abusive mother, who was affiliated with the notorious 18th Street gang. When the woman he called his “grandmother” died when he was 12, and her husband moved away, he was forced to live alone, drop out of school, and support himself by working in agriculture, according to his petition.

While living in a gang-ridden neighborhood in the town of Monjas, about a 75-mile drive from Guatemala City, he suffered constant abuse and threats — including from his own mother, who told the boy to “watch his back.” Or else, she said, she or another gang member would kill him.

One day in 2016, he says, they tried to do just that. When Hernandez refused to carry out an extortion attempt for the 18th Street gang, one of its members shot the boy in the stomach. He ended up in the hospital for months, fearing for his life and for what might happen if he went to the police.

At the hospital, his mother told him the only way to survive was to join the gang.

He fled north, and on Oct. 27, 2017, the day after his 17th birthday, he presented himself on the U.S.-Mexico border and asked for asylum. At first, authorities placed him in a shelter for migrant youth near Los Angeles, his lawyers said. But then he was made to undergo a dental exam.

In these exams, as reported by Vice, X-rays taken of a migrant’s teeth — sometimes without explanation — are sent to a forensic dentist for analysis. They study the migrant’s wisdom teeth, factor in their race and gender, and then use a computer program to determine multiple outputs, including an estimated age range and the probability that the person is older than 18.

David Senn, a clinical assistant professor of dentistry at the University of Texas Health Science Center at San Antonio, who has conducted hundreds of these exams for the federal government, said that what happens next is out of his hands. “Most people who do this work are not trying to be policemen or to be Border Patrol agents or immigration,” he told the Los Angeles Times in June. “What we’re trying to do is help. What we’re trying to do is protect children.”

However, the research behind the science has been based on studies of “ethnically homogenous populations,” according to a 2009 DHS audit, and the development of bone and teeth can be affected by biological variations, cultural differences and other factors — most notably, abuse and torture. Iain Pretty, a professor of public health dentistry at the University of Manchester, called the process a “minefield” because of a lack of science and the ethical concerns it raises.

In 2008, Congress passed a law saying that immigration officials cannot rely solely on forensic testing of either bones or teeth to determine a migrant’s age. (Senn said he agreed with the rule, telling the Times, “We should never be used as the only method to determine age.”) If the exam says there’s a 75 percent probability that a migrant is an adult, then the government will refer them to adult detention, but it must also find another source of proof.

Yet Hernandez’s lawyers say that didn’t happen in his case. That claim has been echoed by several other migrants who arrived at the border with nothing, let alone a passport or birth certificate proving their age. Not long after Hernandez’s exam, ICE officials showed up to take him away in shackles to the Theo Lacy jail in Orange County, Calif.

ICE said it does not track the total number of erroneous determinations. But attorneys like Lindsay Toczylowski, the executive director of Immigrant Defenders Law Center, say the practice has become increasingly common in recent years. That has led to dozens of teenagers ending up in adult facilities — including Hernandez.

“I knew the moment he laid eyes on me,” Toczylowski said, “that he was a child.”

Shuttled between the James A. Musick Facility and Theo Lacy Facility, both local jails in Orange County that contracted with ICE, lawyers said that Hernandez lacked schooling, nutrition and proper sleep, amid a population of mostly suspected gang members, detainees with criminal convictions and those with mental health needs.

“Maybe it’s easier to say, ‘Oh, this person did something wrong. They don’t deserve a comfortable life,’ " Sung said. “But for a kid who’s done nothing wrong except come to the border to seek asylum, as he’s entitled to do, it takes my breath away.”

Unlike child shelters, adult immigration facilities lack schooling, on-site social services and mental-health care, which would have been particularly important for Hernandez, who was diagnosed with PTSD, his lawyers said. The Lacy jail in particular had been subject to scrutiny from both the California state attorney general and DHS itself, which called out “unsatisfactory conditions” in a 2017 inspection report. The heart of that report focused on the facility’s use of disciplinary segregation, which violated ICE’s own guidelines.

When Hernandez was placed in detention, DHS began deportation proceedings against the teen. He was forced to represent himself in court without the legal assistance or protections he could have enjoyed had the government recognized him as a minor, according to the petition, which was filed Tuesday in the U.S. District Court for the Central District of California.

On Jan. 9, 2018, an immigration judge ordered him deported. But as Hernandez appealed and filed an application for asylum, the Guatemalan consulate produced a birth certificate proving he was still 17. In September 2018, he was returned to a shelter for migrant children.

He stayed for less than two months, until his 18th birthday, when an ICE officer returned to the shelter and returned him to an adult facility. Nearly a year later, weeks before Hernandez turns 19, he’s back in detention.