SCRANTON, Pa.  A former Pennsylvania judge went on trial in federal court on Tuesday, charged with racketeering, bribery and extortion in what prosecutors say was a $2.8 million scheme to send juvenile delinquents to privately run prisons.

The case against the judge, Mark A. Ciavarella Jr., who presided in Luzerne County, drew national attention for what legal experts say is a dangerous gap in the juvenile justice systems of many states  children appearing in court without lawyers.

Mr. Ciavarella, now 60, sentenced thousands of young people, funneling them into two private detention centers prosecutors say were run by his friends who slipped him payments in a “cash for kids” scheme.

Few of the young people had lawyers, a chronic problem that legal scholars say makes guilty pleas more likely, saddling them with criminal records. The state has since expunged more than 6,000 records of youths Mr. Ciavarella sentenced, some for crimes as small as stealing a jar of nutmeg.