It was late on a weekend night and Kara was bored. Her adopted mother, Dotty—nearly 70, arthritic, and having recently recovered from heart surgery—was asleep upstairs. Talking with her cousin on the phone wasn’t easing Kara’s restlessness. She wanted a snack from the corner store a few blocks away, so the 12-year-old told her cousin she was going to drive her mom’s car.

“That is not a good idea,” her cousin warned.

“I’ll be all right,” Kara said before hanging up. She went outside, turned the ignition of Dotty’s burgundy Oldsmobile, and carefully stepped on the gas.

Kara, who was in seventh grade and had been assessed as a gifted student, drove a few blocks—passing near the spot where she’d gotten into a fight with a gang of girls who’d beaten up her friend, and then by the local fast-food joint where a woman would later be shot during a robbery. Then she tried to park and swiped a dumpster, scraping the front of the Olds. Panicked, she drove home, parked, and slipped upstairs.

When Kara woke up the next morning, two policemen were standing at the foot of her bed. Dotty had seen the scratch, called the cops, and told them that she suspected her increasingly hard-to-handle daughter. Kara confessed. The officers saw an elderly, single mom and a cocky adolescent in need of some discipline. Not long afterward, Kara was summoned to juvenile court.

Kara was born in 1991, while her biological mom was in prison for stabbing an ex-boyfriend. To keep her out of the foster system, family friends Dotty and Ralph adopted Kara. (Their names and those of others appearing in this story have been changed.) Both were then in their early 60s. Kara became attached to Ralph, but he died when she was only six years old, and she started to act out. Tantrums gave way to drinking with friends and smoking cigarettes. Dotty struggled to keep up.

In front of the judge, Dotty’s frustrations poured out: Kara was always talking back, always disobedient. She took advantage of their age difference and Dotty’s health problems. Dotty was worried that her daughter’s underage driving was going to raise the rates of her car insurance. As she listened to her mother vent, Kara didn’t know how to act—especially in court—so she just sat there and fixed a smile on her face.

“I couldn’t believe it at first. It was so unreal,” she says. “It felt like we were all just troubled,” she says. “Not like we were horrible.”

That didn’t help. “The judge looked at me and said, ‘You think this is funny? How about 10 days in secure detention? Would you think that’s funny?'” Kara, who is now 25, tells me. We are in her hometown in Virginia, walking toward the courthouse where she first faced a judge—and where she spent a lot of time during law school. She’s now waiting on her bar exam results.

After the judge’s sentence that day 12 years ago, an officer handcuffed her and drove her to a hulking concrete detention center where she had to undress and put on her uniform: underwear, a sweatsuit, and socks. “I couldn’t believe it at first. It was so unreal,” she says. She spent most of that first day in tears. Over the next 10 days, she met a lot of girls like her. “It felt like we were all just troubled,” she says. “Not like we were horrible.” When Kara was released on probation, she was given rules she had to abide by: obey curfew, don’t skip school or probation meetings, don’t talk back to your parents, and keep your room clean.

From that point on, Kara and Dotty had to meet with Kara’s probation officer every week. And every week Dotty would tell the officer about Kara’s late hours, how she was disrespectful. “My health being so bad, she got away with a lot. I didn’t know who else to go to,” Dotty tells me. She didn’t realize the list of grievances she was getting off her chest constituted “technical violations”—infractions of the terms of Kara’s probation. When Dotty repeatedly complained that Kara didn’t clean her room or make her bed, Kara was sent back to juvie. When Dotty kept telling the probation officer that Kara talked back, she was sent back again. A probation officer once busted Kara by calling her house after curfew, catching her out. By the time she was 16, Kara had been detained three times—one of the nearly 50,000 adolescent girls who enter the courts every year because of a system of criminalizing low-level offenses that has long been biased against girls. “My biggest thing was not making my bed,” Kara says. “That was considered a violation of probation. That I got locked up for it is ridiculous.”

How does a kid wind up in jail for an unmade bed? Ironically, the answer lies in the primary goal of the juvenile justice system: rehabilitation. So that young people have a chance at changing their behavior, juvenile court judges are given great discretion in sentencing. Court proceedings are more informal than those for adults. Juveniles’ misdeeds are “petitioned” at a hearing rather than prosecuted at a trial. Instead of being found guilty, kids are “delinquent”—language that implies a state both psychological and changeable. Juveniles can also be charged with infractions known as “status offenses,” so named because the person’s status as a minor is the single factor that makes his or her actions illegal. Running away from home is a status offense. So is skipping school or missing curfew. Once a kid is roped into the system, she can be drawn in again and again for minor violations of her probation. The flexibility in the system means kids have greater opportunities to reform, but it also means judges have a lot of leeway to inflict arbitrary and extreme punishment for, say, an attitude problem.

In 1974, in its first big push to set some national standards for how courts should treat kids, Congress passed the Juvenile Justice and Delinquency Prevention Act, which emphasized keeping nonviolent kids out of the system. States were told to stop throwing juveniles in secure detention for status offenses because these kids, lawmakers surmised, would be better served by community treatment programs, family therapy, and the like.

E.E., age 13, Los Padrinos Juvenile Hall, Los Angeles area. E.E. has been here five times for aggressive behavior. She normally lives with her mother and sister. “Me and my mom get into it a lot. It sometimes is verbal but then it gets physical,” she says. “My mom treats me bad.” Sometimes her mother kicks her out of the house, and once “she made me sleep outside with the dogs.” E.E. hopes she will be able to live with her grandmother when she gets out. If not, “they will send me to another lockdown.” Richard Ross

Funding, however, was scarce. So a lot of judges simply sent kids back home with entreaties that they do better—”don’t miss curfew again” or “stop skipping school.” If kids disobeyed these orders and ended up in court, judges had little recourse but to send them home with yet another warning, though many opted instead to bring new charges, like criminal contempt, in order to detain kids anyway, says Robert Schwartz, who co-founded the Juvenile Law Center in 1975 and ran it from 1982 to 2015.

In 1980, members of the National Council of Juvenile and Family Court Judges lobbied Congress to reinstate their formal power to send kids to detention for status offenses. Congress passed an amendment that said that if a kid disobeyed the judge’s original requests, or “valid court orders,” the judge could now put that kid in detention. Some states have since dropped the use of this loophole, but Kara’s home state of Virginia is one of 26 states that still use it, along with the District of Columbia.

As a result, the portion of juvenile detainees who are locked up for status offenses and technical violations has hovered around 25 percent. “What started as a small exception has become a loophole you can drive a truck through,” says Liz Ryan, president of Youth First, a national campaign opposing juvenile incarceration. “It’s created a pathway for kids to come into the justice system who really shouldn’t be there.”

Kara’s story also points to another issue: The juvenile justice system has a long history of judging the morals of girls differently from those of boys. The first juvenile court, established in 1899, had two lists of sins for the sexes: For girls, “frequent attendance at saloons and pool halls” and “the use of indecent language” were actionable offenses. In the ’30s and ’40s, girls were hauled into court for being in “danger of becoming morally depraved.” In the 1960s, New York let juvenile courts have jurisdiction over girls until they were 18 years old; boys aged out at 16. In the early ’70s, these kinds of gendered discrepancies were overturned in court, but that didn’t mean judges suddenly treated boys and girls equally.

Over the last 30 years, the percentage of girls in the juvenile justice system has dramatically increased, not because girls have grown more criminal, but because the system has increasingly criminalized them for things like breaking curfew or running away. Between 1995 and 2009, cases of breaking curfew rose by 23 percent for girls—and just 1 percent for boys. In 2011, girls made up 53 percent of runaway cases brought before a judge. Between 1996 and 2005, arrests for “simple assault”—which could be as minor as a daughter throwing a toy at her mom—went up 24 percent for girls and down 4 percent for boys. By 2013, girls were almost twice as likely as boys to be in detention for simple assault and certain other nonviolent offenses.

M.E., age 14 (left): “I got here yesterday. It’s my first time.” J.R., age 16 (center): “I probably get out today. I can’t wait to see my baby. He’s 10 months. He’s been with my mom since I’ve been here…My mom will come to pick me up. She is at home with my little boy.” C.J., age 14 (right): “I’ve been here 34 days. On the outs I get really good grades. How long am I here for? Long!” Richard Ross

So how did we get to this statistically unlikely place? Meda Chesney-Lind, a University of Hawaii-Manoa women’s studies professor who focuses on girls in the juvenile justice system, blames two things. The first is the practice of cops treating status offenses like more serious offenses, such as simple assault, that allow for immediate detention. And the second is “judicial paternalism.” Judges, she says, are the final step in a system that’s often stacked against girls from the start: “Parental bias morphs into police bias, which morphs into court bias.”

“Courts are more likely to open a case with girls because they don’t see what they’re doing as punishment. They see it as social work,” says Andrew Spivak, a University of Nevada-Las Vegas professor and co-author of a study on gender and the treatment of status offenders. “Courts think that they need to protect girls and give them guidance.”

Take sex and drugs: A 2007 study from California State University-Fullerton looked at more than 100 juvenile court files and found that boys’ drug use was often framed as a lifestyle choice, but girls’ drug use was presented as contributing to “criminal behaviors.” Boys’ sexual behavior was usually only recorded if it pointed to potential sex crimes such as pedophilia or violence. Not so with girls. Probation officers (in this study, mostly women) wrote notes like, “She admitted to having unprotected sex and was not interested in modifying behaviors.”

Three different studies conducted by criminologists over the last decade found that juvenile records often stereotype girls: She is “big” and “very loud.” Girls are “criers” who are “promiscuous,” “manipulative,” and “pouting.” Jeannette Pai-Espinosa, president of the National Crittenton Foundation, a nonprofit that works with at-risk girls, says, “Being ‘big’ means a girl is more of a threat.” Once this sort of coded language is in a juvenile offender’s file, it can come back to haunt her. “If there’s any kind of altercation, an officer of the court can look at the file and say, ‘Oh, she’s aggressive,’ and lock her up,” Pai-Espinosa says.

Of course, racial and heteronormative biases compound the problem: A 2013 study found that the likelihood of black girls being found guilty for a status offense is almost three times greater than the likelihood for white girls, and a 2015 study showed that 41 percent of LGBTQ girls in detention were there for status offenses, compared with about 35 percent of straight girls. Kara is black and gay—two facts that vastly increased her chances of being detained.

While reporting this article, I spoke to women in their 20s and 30s who’d spent a few days or even weeks in detention for actions that look like coping mechanisms, not crimes.

One of the most heartbreaking stories came from a young woman who was arrested for running away from her foster home. She had been taken from her biological family at the age of seven after child protective services found they were using a hospital emergency center as a shelter. She ran away because she wanted to see her sister. When she was 17 years old, she was arrested on an outstanding warrant and put in an adult jail with violent criminals. She was terrified. “I was just arrested, no explanation. I didn’t even see a judge,” she says.

Another young woman was locked up for almost two weeks at the age of 15 after running away from her home in South Carolina. She’d been molested by one of her mother’s many boyfriends and berated for actions as trivial as doodling on notebook paper. “No one asked if there could be something wrong, a reason” for acting out, she says. She wasn’t the only one I spoke to with such a story. Nationally, more than a third of girls put in juvenile detention say they were sexually abused when they were young.

“If the reason you violated the law is because of trauma and then you’re detained, well then we have just sent you to hell and back,” says Darlene Byrne, a district court judge in Travis County, Texas, who has presided over juvenile cases for eight years. Byrne says she feels lucky that her jurisdiction offers ankle monitors to kids so she can track but not detain vulnerable children.

It has been well documented that incarcerating young people for small infractions increases the chance that they’ll get into more serious crimes as they age. Even a brief period in detention can lead to mental and physical health issues, higher unemployment rates, lower lifetime earnings, and substance abuse. The moral judgment that underlies the charges girls face can also change how they see themselves. “Once they internalize that they are ‘bad girls,'” says Pai-Espinosa, “it almost creates a self-fulfilling prophecy.”

That was true in Kara’s case. “The more I got in trouble, the less self-restraint I had,” she says. “I didn’t want to be locked up all the time. But the more I went, the more I felt invincible.” Her reputation around town toughened—and returning to detention began to feel inevitable.

Kara’s judges didn’t spend much time trying to understand why she was acting out. If they had, they might have discovered that she was still grieving for Ralph, or that in her neighborhood, more people ended up in prison than in college. On top of that, when she was 11, Kara also started to understand that she was attracted to girls. “I thought I was a bad person for feeling differently.”

After two detentions, when she was 16, Kara was caught with alcohol. This turned out to be a lucky break because the judge gave her more options. Kara could either spend six months in secure detention or attend drug court—where judges and counselors help offenders get off probation and stay clean. She chose drug court.

F.E., age 17 Cuyahoga County Juvenile Detention Center, Ohio. This is F.E.’s sixth incarceration since she was 13 years old. She has violated probation a number of times, most recently for fighting with her mother, who called the police. Her parents are separated. When F.E. was 12, her mother sent her to Alabama to live with her father, who she says beat her and only gave her $20 a week for food. “I told my mom how bad it was,” she says. “But she thought I was just saying that.” She began acting out, so her father kicked her out. She went to live with a friend, but her father found her, broke the door down, and beat her. She had a black eye and bruises, and her father sent her back home to Ohio, where she took Molly and Xanax. She is now in a drug program while in detention. “I am going to go to Lakewood College and then to Kent State and do a degree in psychology,” she says. “If I ever get on track.” Richard Ross

When she was locked up for probation violations, Kara had worried her grades would slip or she would lose her after-school job at a nursing home. But in her weekly meetings at court, she, her mom, a case manager, and a judge went over her school attendance, grades, behavior, and drug test results. Her drug court counselors showed her that getting scholarships to college and even law school—Kara had dreamed of becoming a lawyer since she first watched Law & Order—was possible. “It wasn’t like, ‘You messed up,’ and lock you up,” Kara says. It was, “You want to be a lawyer? You want to go to school? Let me help you fill out your applications.”

“If I’d gone [to juvenile detention] for those six months, there would have been no coming back,” Kara says, throwing her hands up. “I would have lost hope.” In 2008, Kara graduated from drug court; in 2013, she graduated from college; and the summer of 2016, she completed law school.

Last year, Kara worked with the public defender’s office as a legal intern—in the same juvenile court where she had been sent as a kid. Last December, when we walked into the courthouse the postman gave her a hug and the security guard flirted with her. “I know everybody,” she said with a laugh. She has faced some of the district attorneys who once prosecuted her, and she’s even argued juvenile cases before the very judge who first locked her up. It was terrifying to walk into his courtroom again, but “I always told people back at home that I would come back and be a lawyer.”

Today, juvenile and family court judges are pressuring Congress for action—this time to close the loophole they helped open. Judge Darlene Byrne says the profession has largely reversed its position because of the ample evidence proving detention hurts kids: “It’s time for the courtroom to come up to speed with the science.”

Last year, Sen. Sheldon Whitehouse (D-R.I.), who co-sponsored the reauthorization of the Juvenile Justice and Delinquency Prevention Act with Sen. Chuck Grassley (R-Iowa), invoked the evidence showing that incarceration for status offenses is ineffective. The House is set to vote on its version of Whitehouse’s Senate bill on Tuesday, and if both chambers can’t agree by the end of the year, they’ll have to start from scratch in January. So far, the bill’s success this term is up in the air. In February, the reauthorization failed to pass the Senate unanimously—which would have expedited its passage through Congress. Sen. Tom Cotton (R-Ark.) opposed closing the “valid court order” loophole. On the Senate floor, he said his state’s Legislature had chosen to “retain secure confinement as a last-resort option,” and that he didn’t “believe Congress should second-guess that choice.” He didn’t add that detention in his state is not a last resort: It’s among the top five worst states in detaining low-level offenders—about a third of detained youths in Arkansas are locked up for status offenses and technical violations.

Kara knows all too well how the effects of detention can linger: She had to disclose her childhood run-ins with the court when she entered law school. During her final semester, she worried she would have to submit her juvenile record when she applied to take the bar exam. She didn’t, but she still wonders if she’ll ever shake the reputation she got when she was a kid: “I worry they will think I have a bad streak,” she says of her future colleagues. “Will people look at me and think, ‘What kind of attorney is she going to be?'”

Richard Ross’ photos first appeared in his 2015 book, Girls in Justice. For more, visit juveniles-in-justice.com.

This article was originally published in our September/October 2016 issue and has been updated.