At worst, Hillary Transue thought she might get a stern lecture when she appeared before a judge for building a spoof MySpace page mocking the assistant principal at her high school in Wilkes-Barre, Pa. She was a stellar student who had never been in trouble, and the page stated clearly at the bottom that it was just a joke.

Instead, the judge sentenced her to three months at a juvenile detention center on a charge of harassment.

She was handcuffed and taken away as her stunned parents stood by.

"I felt like I had been thrown into some surreal sort of nightmare," said Hillary, 17, who was sentenced in 2007. "All I wanted to know was how this could be fair and why the judge would do such a thing."

The answers became a bit clearer on Thursday as the judge, Mark A. Ciavarella Jr., and a colleague, Michael T. Conahan, appeared in federal court in Scranton, Pa., to plead guilty to wire fraud and income tax fraud for taking more than $2.6 million in kickbacks to send teenagers to two privately run youth detention centers run by PA Child Care and a sister company, Western PA Child Care.

While prosecutors say that Judge Conahan, 56, secured contracts for the two centers to house juvenile offenders, Judge Ciavarella, 58, was the one who carried out the sentencing to keep the centers filled.

"In my entire career, I've never heard of anything remotely approaching this," said Senior Judge Arthur E. Grim, who was appointed by the State Supreme Court this week to determine what should be done with the estimated 5,000 juveniles who have been sentenced by Judge Ciavarella since the scheme started in 2003. Many of them were first-time offenders and some remain in detention.

The case has shocked Luzerne County, an area in northeastern Pennsylvania that has been battered by a loss of industrial jobs and the closing of most of its anthracite coal mines.

And it raised concerns about whether juveniles should be required to have counsel either before or during their appearances in court and whether juvenile courts should be open to the public or child advocates.

If the court agrees to the plea agreement, both judges will serve 87 months in federal prison and resign from the bench and bar. They are expected to be sentenced in the next several months. Lawyers for both men declined to comment.

Since state law forbids retirement benefits to judges convicted of a felony while in office, the judges would also lose their pensions.

With Judge Conahan serving as president judge in control of the budget and Judge Ciavarella overseeing the juvenile courts, they set the kickback scheme in motion in December 2002, the authorities said.

They shut down the county-run juvenile detention center, arguing that it was in poor condition, the authorities said, and maintained that the county had no choice but to send detained juveniles to the newly built private detention centers.

Prosecutors say the judges tried to conceal the kickbacks as payments to a company they control in Florida.

Though he pleaded guilty to the charges Thursday, Judge Ciavarella has denied sentencing juveniles who did not deserve it or sending them to the detention centers in a quid pro quo with the centers.

SCROLL TO CONTINUE WITH CONTENT Never Miss a Beat. Get our best delivered to your inbox.







But Assistant United States Attorney Gordon A. Zubrod said after the hearing that the government continues to charge a quid pro quo.

"We're not negotiating that, no," Mr. Zubrod said. "We're not backing off."

No charges have been filed against executives of the detention centers. Prosecutors said the investigation into the case was continuing.

For years, youth advocacy groups complained that Judge Ciavarella was unusually harsh. He sent a quarter of his juvenile defendants to detention centers from 2002 to 2006, compared with a state rate of 1 in 10. He also routinely ignored requests for leniency made by prosecutors and probation officers.

"The juvenile system, by design, is intended to be a less punitive system than the adult system, and yet here were scores of children with very minor infractions having their lives ruined," said Marsha Levick, a lawyer with the Philadelphia-based Juvenile Law Center.

"There was a culture of intimidation surrounding this judge and no one was willing to speak up about the sentences he was handing down."

Last year, the Juvenile Law Center, which had raised concerns about Judge Ciavarella in the past, filed a motion to the State Supreme Court about more than 500 juveniles who had appeared before the judge without representation. The court originally rejected the petition, but recently reversed that decision.

The United States Supreme Court ruled in 1967 that children have a constitutional right to counsel. But in Pennsylvania, as in 20 other states, children can waive counsel, and about half of the children that Judge Ciavarella sentenced had chosen to do so. Only Illinois, New Mexico and North Carolina require juveniles to have representation when they appear before judges.

Clay Yeager, the former director of the Office of Juvenile Justice in Pennsylvania, said typical juvenile proceedings are kept closed to the public to protect the privacy of children.

"But they are kept open to probation officers, district attorneys, and public defenders, all of whom are sworn to protect the interests of children," he said. "It's pretty clear those people didn't do their jobs."

On Thursday in Federal District Court in Scranton, more than 80 people packed every available seat in the courtroom. At one point, as Assistant United States Attorney William S. Houser explained to Judge Edwin M. Kosik that the government was willing to reach a plea agreement with the men because the case involved "complex charges that could have resulted in years of litigation," one man sitting in the audience said "bull" loud enough to be heard in the courtroom.

One of the parents at the hearing was Susan Mishanski of Hanover Township.

Her son, Kevin, now 18, was sentenced to 90 days in a detention facility last year in a simple assault case that everyone had told her would result in probation, since Kevin had never been in trouble and the boy he hit had only a black eye.

"It's horrible to have your child taken away in shackles right in front of you when you think you're going home with him," she said. "It was nice to see them sitting on the other side of the bench."