LAST May two 12-year-girls lured Payton Leutner into the woods in Waukesha, Wisconsin, stabbed her 19 times and left her for dead. The girls claim they were trying to appease the Slender Man, a fictional bogeyman who preys on children. Ms Leutner is now back at school, but her alleged assailants are in police custody. In Wisconsin all killers over the age of ten must begin their cases in criminal court, and on March 13th a Waukesha judge decided to try them as adults. If they are convicted, these two girls could be in prison for up to 65 years.

The practice of charging young people as adults gained momentum in America in the 1990s, as youth crime spiked. Between 1990 and 2010 the number of juveniles in adult jails went up by nearly 230% (see chart). Now about a tenth of confined young people are in an adult prison or jail. This is bad for two reasons. It is costly: more than $31,000, on average, to incarcerate an adult for a year. And it tends to turn young tearaways into serious criminals. Young people who are charged as adults are nearly 35% likelier to be rearrested than those who are tried as juveniles, according to the Centres for Disease Control.

Whether a child is judged as an adult depends more on the state than the crime. In Pennsylvania any child accused of homicide must begin in adult court. In Mississippi a 13-year-old accused of a felony will be sent to adult court, but in Alabama offenders remain juveniles until they are 16 (though judges can choose to send those as young as 14 to criminal court). In North Carolina and New York 16-year-olds always face adult courts. When judges and prosecutors have discretion over how to charge a juvenile, they use it unevenly. In 2012 black youths were 40% more likely to be charged as adults as their white peers, according to the Justice Department.

Yet young people are easier to rehabilitate than older offenders, so programmes that keep them out of prison in the first place can save money and reduce crime. Connecticut, for example, once led the country in incarcerating minors as adults, confining 20% more than any other state. But the state cut the number of young people it locks up by more than 75% between 1997 and 2011, by raising the age at which offenders can be tried as juveniles and by arresting fewer youngsters for minor offences. Instead of expelling or arresting rowdy pupils, several school districts now offer mental-health treatment. Connecticut has saved millions of dollars, and juvenile crime there continues to drop.

Since 2005, according to the Campaign for Youth Justice, an advocacy group, 29 states plus Washington, DC have passed laws to make it harder to prosecute and sentence juveniles as adults, and several others are thinking about it.

The Supreme Court has bolstered this change of heart. Arguing that young people have an “underdeveloped sense of responsibility”—no kidding—the justices banned putting them to death in 2005. In 2010 the court struck down mandatory life sentences without parole for minors charged with crimes other than murder, and in 2012 the ruling was extended to all juveniles. Judges can still throw young killers in jail and toss away the key, but they must first take into account the “immaturity [and] impetuosity” of youth.

States are split over whether the Supreme Court’s ruling on mandatory life sentences applies retroactively. Some 2,500 inmates are still serving life sentences without parole for crimes they committed as children, according to the Juvenile Law Centre, an advocacy group. On March 19th Florida became the tenth state to decide that such prisoners should be resentenced; this could affect roughly 200 people. In Louisiana, Michigan, Minnesota and Pennsylvania felons who started their mandatory life sentences when young still moulder without reprieve; but the court announced on March 23rd that it would soon consider those cases, too.