The 16-year-old girl was visibly intoxicated, her speech slurred, when a drunk 16-year-old boy sexually assaulted her in a dark basement during an alcohol-fuelled pyjama party in New Jersey, prosecutors said.

The boy filmed himself assaulting her from behind, her torso exposed, her head hanging down, prosecutors said.

He later shared the cellphone video among friends, investigators said, and sent a text that said, “When your first time having sex was rape”.

But a family court judge said it was not rape. Instead, he wondered aloud if it was sexual assault, defining rape as something reserved for an attack at gunpoint by strangers.

He also said the young man came from a good family, attended an excellent school, had terrific grades and was an Eagle Scout.

Stanford University holds commencement amid sexual assault controversy Show all 21 1 /21 Stanford University holds commencement amid sexual assault controversy Stanford University holds commencement amid sexual assault controversy Stanford student Paul Harrison (C) carries a sign in a show of solidarity for a Stanford rape victim during graduation ceremonies at Stanford University, in Palo Alto, California, on June 12, 2016. Gabrielle Lurie/AFP/Getty Stanford University holds commencement amid sexual assault controversy A woman carries a sign during the "Wacky Walk" to show her solidarity for a Stanford rape victim during graduation ceremonies at Stanford University, in Palo Alto, California, on June 12, 2016. Gabrielle Lurie/AFP/Getty Stanford University holds commencement amid sexual assault controversy Stanford students carried signs in solidarity for a Stanford rape victim during graduation ceremonies at Stanford University, in Palo Alto, California, on June 12, 2016. Gabrielle Lurie/AFP/Getty Stanford University holds commencement amid sexual assault controversy A man carries a sign during the "Wacky Walk" to show his solidarity for a Stanford rape victim during graduation ceremonies at Stanford University, in Palo Alto, California, on June 12, 2016. Gabrielle Lurie/AFP/Getty Stanford University holds commencement amid sexual assault controversy Stanford students Miriam Natvig (L) and Jemima Oslo (R) carried signs in solidarity for a Stanford rape victim during graduation ceremonies at Stanford University, in Palo Alto, California, on June 12, 2016. Gabrielle Lurie/AFP/Getty Stanford University holds commencement amid sexual assault controversy Alizabeth McGowan wears a 1/3 sign on her mortarboard to show solidarity for a Stanford rape victim during graduation ceremonies at Stanford University, in Palo Alto, California, on June 12, 2016. Gabrielle Lurie/AFP/Getty Stanford University holds commencement amid sexual assault controversy Stanford students wear a 1/3 sign on their caps to show solidarity for a Stanford rape victim during graduation ceremonies at Stanford University, in Palo Alto, California, on June 12, 2016. The 1/3 represents a statistic that claims one in three students will experience a sexual assault by the time they graduate college. Gabrielle Lurie/AFP/Getty Stanford University holds commencement amid sexual assault controversy A plane flies over Stanford University with a banner reading "Protect Survivors. Not Rapists. #PerskyMustGo" during the commencement ceremony at Stanford University, in Palo Alto, California, on June 12, 2016. Stanford students are protesting the universitys handling of rape cases alledging that the campus keeps secret the names of students found to be responsible for sexual assault and misconduct. / AFP / GABRIELLE LURIE (Photo credit should read GABRIELLE LURIE/AFP/Getty Images) Gabrielle Lurie/AFP/Getty Stanford University holds commencement amid sexual assault controversy Signs against protesting a rapist are seen during the commencement ceremony at Stanford University, in Palo Alto, California, on June 12, 2016. Gabrielle Lurie/AFP/Getty Stanford University holds commencement amid sexual assault controversy Signs against protesting a rapist are seen during the commencement ceremony at Stanford University, in Palo Alto, California, on June 12, 2016. Gabrielle Lurie/AFP/Getty Stanford University holds commencement amid sexual assault controversy TOPSHOT - A plane flies over Stanford University with a banner reading "Protect Survivors. Not Rapists. #PerskyMustGo" during the commencement ceremony at Stanford University, in Palo Alto, California, on June 12, 2016. Stanford students are protesting the universitys handling of rape cases alledging that the campus keeps secret the names of students found to be responsible for sexual assault and misconduct. / AFP / GABRIELLE LURIE (Photo credit should read GABRIELLE LURIE/AFP/Getty Images) Gabrielle Lurie/AFP/Getty Stanford University holds commencement amid sexual assault controversy Signs against protesting a rapist are seen during the commencement ceremony at Stanford University, in Palo Alto, California, on June 12, 2016. Gabrielle Lurie/AFP/Getty Stanford University holds commencement amid sexual assault controversy Signs against protesting a rapist are seen during the commencement ceremony at Stanford University, in Palo Alto, California, on June 12, 2016. Gabrielle Lurie/AFP/Getty Stanford University holds commencement amid sexual assault controversy A plane flies over Stanford University with a banner reading "Protect Survivors. Not Rapists. #PerskyMustGo" during the commencement ceremony at Stanford University, in Palo Alto, California, on June 12, 2016. Stanford students are protesting the universitys handling of rape cases alledging that the campus keeps secret the names of students found to be responsible for sexual assault and misconduct. / AFP / GABRIELLE LURIE (Photo credit should read GABRIELLE LURIE/AFP/Getty Images) Gabrielle Lurie/AFP/Getty Stanford University holds commencement amid sexual assault controversy Stanford student Paul Harrison (C) carries a sign in a show of solidarity for a Stanford rape victim during graduation ceremonies at Stanford University, in Palo Alto, California, on June 12, 2016. Gabrielle Lurie/AFP/Getty Stanford University holds commencement amid sexual assault controversy Stanford student Paul Harrison (C) carries a sign in a show of solidarity for a Stanford rape victim during graduation ceremonies at Stanford University, in Palo Alto, California, on June 12, 2016. Stanford students are protesting the universitys handling of rape cases alledging that the campus keeps secret the names of students found to be responsible for sexual assault and misconduct. / AFP / GABRIELLE LURIE (Photo credit should read GABRIELLE LURIE/AFP/Getty Images) Gabrielle Lurie/AFP/Getty Stanford University holds commencement amid sexual assault controversy Stanford student Paul Harrison (C) carries a sign in a show of solidarity for a Stanford rape victim during graduation ceremonies at Stanford University, in Palo Alto, California, on June 12, 2016. Gabrielle Lurie/AFP/Getty Stanford University holds commencement amid sexual assault controversy Stanford student Paul Harrison (C) carries a sign in a show of solidarity for a Stanford rape victim during graduation ceremonies at Stanford University, in Palo Alto, California, on June 12, 2016. Gabrielle Lurie/AFP/Getty Stanford University holds commencement amid sexual assault controversy A woman carries a sign in solidarity for a Stanford rape victim during graduation at Stanford University, in Palo Alto, California, on June 12, 2016. Gabrielle Lurie/AFP/Getty Stanford University holds commencement amid sexual assault controversy A woman carries a sign in solidarity for a Stanford rape victim during graduation at Stanford University, in Palo Alto, California, on June 12, 2016. Gabrielle Lurie/AFP/Getty Stanford University holds commencement amid sexual assault controversy Stanford students John Lancaster Finley(L) and Brandon Hill(C) carry signs during the "Wacky Walk" to show their solidarity for a Stanford rape victim during graduation ceremonies at Stanford University, in Palo Alto, California, on June 12, 2016. Gabrielle Lurie/AFP/Getty

Prosecutors, the judge said, should have explained to the girl and her family that pressing charges would destroy the boy’s life.

So he denied prosecutors’ motion to try the 16-year-old as an adult.

“He is clearly a candidate for not just college but probably for a good college,” Judge James Troiano of Superior Court said last year in a two-hour decision while sitting in Monmouth County, New Jersey.

Now the judge has been sharply rebuked by an appeals court in a scathing 14-page ruling that warned the judge against showing bias towards privileged teenagers.

In doing so, the appeals court cleared the way for the case to be moved from family court to a grand jury, where the teenager, identified only as GMC in court documents, will be treated as an adult.

New Jersey law allows juveniles as young as 15 to be tried as adults when accused of serious crimes, and the grand jury will weigh whether to indict him on the sexual assault accusation.

In recent years, judges across the country have come under fire for the way they have handled sexual abuse cases.

One of the most notorious was in 2016, when a judge in California sentenced a Stanford University student to six months in jail after he was found guilty of sexually assaulting an unconscious woman.

After an intense public backlash, California voters recalled the judge.

Judge Troiano, who is roughly 70, was one of two family court judges whom appeals courts in New Jersey have criticised in recent weeks over relatively similar issues.

In the other case, the appellate division reversed another judge’s decision not to try a 16-year-old boy as an adult after he was accused of sexually assaulting a 12-year-old girl in 2017.

Support free-thinking journalism and attend Independent events

The second family court judge, Marcia Silva, sitting in Middlesex County, denied a motion to try the teenager as an adult and said that “beyond losing her virginity, the State did not claim that the victim suffered any further injuries, either physical, mental or emotional”.

The appellate judges also upbraided Silva, overturning her decision and noting that the teenager could be culpable because the 12-year-old was not old enough to provide consent in the first place.

The judge in Monmouth County, Mr Troiano, was scolded by the appellate court, according to the panel’s decision.

“That the juvenile came from a good family and had good test scores we assume would not condemn the juveniles who do not come from good families and do not have good test scores from withstanding waiver application,” the panel wrote in its decision.

A spokeswoman for the administrative office of the courts said the judges had no comment on the case. She said Mr Troiano, a veteran judge who retired several years ago, was asked to occasionally fill vacancies on the bench.

Family court cases are typically closed to the public, but the judges’ comments surfaced in June when the appeals court decisions were made public, joining a series of contentious sexual assault cases that have ignited outrage over a legal system that advocates for victims say is warped by bias and privilege.