Hillary Transue couldn’t imagine that anyone could take serious offense. In July 2006 she had created a MySpace page that mocked the vice principal of her high school in Mountain Top, Pa., by suggesting the woman daydreamed “about Johnny Depp in nothing but tighty whites.” The first shock for Transue, then 14, was that the vice principal notified the police and pressed harassment charges. But that was nothing compared to her disbelief when she appeared before juvenile judge Mark Ciavarella Jr. in April 2007. Expecting no more than a slap on the wrist, she and her mother, Laurene, hadn’t even hired a lawyer. Instead she got a harsh lecture from Ciavarella, who ended by announcing “adjudicated delinquent!” and banging down his gavel. Hillary was taken away in handcuffs, sentenced to three months in a boot camp. “The whole thing lasted about 30 seconds,” she says. “It was so surreal.”

But all too common in Luzerne County, as it turned out. Stunned by what had happened to her daughter, Laurene Transue began asking questions about the workings of Ciavarella’s court. She ultimately enlisted the assistance of the Juvenile Law Center in Philadelphia, which helped the FBI uncover an astonishing scandal: Ciavarella and another judge, Michael Conahan, pleaded guilty on Feb. 12 to $2.6 million in fraud and tax evasion in a kickback scheme that federal prosecutors say involved sending thousands of juveniles to two private detention facilities—even if it meant railroading teens for the smallest infractions. (Ciavarella and Conahan have denied that they were paid cash for kids.) On March 26 a Pennsylvania judge announced that the records of hundreds of kids sent away would be expunged, with the prospect that even more would be cleared in the months ahead. “It’s impossible to describe the level of outrage you feel,” says Marsha Levick, deputy director of the Juvenile Law Center. “There is nothing else in the history of the legal system like it.”

Get push notifications with news, features and more.

Certainly Transue had never experienced anything like what she found at Camp Adams. (Prosecutors have not accused Camp Adams of being part of the kickback scheme.) On arrival she was given a pair of sweatpants, a T-shirt and used underwear. “It was raining, and it looked like a desolate campground in the middle of nowhere,” she says. “The first night was pretty horrible. I cried a lot.” She was allowed to speak to her family for only eight minutes a week. Laurene contacted the Juvenile Law Center, which furnished an attorney who got Hillary another hearing before Ciavarella. After a month Hillary was set free. But officials at the Law Center, appalled by Ciavarella’s treatment of Hillary, pressed their inquiry about why the judge seemed to have turned a key legal principle—which is to use incarceration of juveniles only as a last resort—on its head.

The investigators came across numerous cases of what appeared to be grotesquely severe punishment handed out by Ciavarella. One of them involved Charlie Balasavage of Wilkes-Barre, whose ordeal began in the summer of 2006 when he was 15 and his parents bought him a used motor bike from a cousin. A few weeks later, the police showed up at the house to inform Charlie that the bike had been stolen. The family explained they had no idea, but that didn’t matter—all three of them were arrested.

The charges against Charlie’s parents, Charlie Sr. and Joanne, were quickly dropped. But in January 2007 Charlie was summoned to appear before Ciavarella. Outside the courtroom parents and their children waited to be called in. The Balasavages soon realized that they were in for trouble. How? “That day I did not see one parent come out with a kid,” says Charlie, “and there were a lot of kids.” Sure enough, when it was Charlie’s turn, Ciavarella threw the book at him, sentencing him to six months at Camp Adams and having him led away in shackles. (Adults convicted of receiving stolen merchandise usually get probation.) Since then Charlie has been to more than half a dozen youth offender camps, two of which have been implicated in the kickback scheme. “You feel you’re in this wind tunnel,” says an angry Joanne, “a whirlpool, and you can’t get out.”

Parents felt powerless to stand up to the judges. “Ciavarella sold kids like they were cattle—black, white, it didn’t matter what color they were,” says Fredrick Johnson, whose son DayQuawn, 16, was thrown in a juvenile facility for three days in 2006. His crime? He had been given a subpoena to testify against a classmate who allegedly had a knife. DayQuawn, who was 13 and suffers from a learning disability, never told his parents and never showed up for the hearing, which led to his being hauled away from his school in handcuffs.

Attorneys for the Juvenile Law Center discovered that kids who appeared before Ciavarella were sent to detention facilities 26 percent of the time, while the state average is between 8 and 10 percent. What’s more, a large number of kids were evidently encouraged to waive their right to have an attorney present. Prosecutors say Conahan even made sure authorities shut down a county facility for juveniles that would have competed with the private ones. There were rumbles about irregularities in Ciavarella’s courtroom, but for years nothing came of them. “In that courtroom you were presumed guilty,” says attorney Barry Dyller, who had clients before Ciavarella. “But whatever anyone’s suspicions, no one had actual evidence of wrongdoing.”