NEWARK, N.J. -- A New Jersey appeals court on Friday threw out the 15-count conviction of a former Rutgers University student whose roommate killed himself after being captured on a webcam kissing another man.

The three-judge panel dismissed four bias intimidation counts against Dharun Ravi because of a change in state law since Ravi’s 2012 trial.

The judges ordered a new trial on other counts including invasion of privacy, tampering with evidence and hindering apprehension because, they wrote, the evidence prosecutors used to prove the bias charges “tainted the jury’s verdict on the remaining charges, depriving defendant of his constitutional right to a fair trial.”

Get Breaking News Delivered to Your Inbox

Ravi faced up to 10 years in prison but was sentenced to 30 days in county jail plus three years’ probation and community service. He ended up serving 20 days.

Prosecutors had argued before the appeals court that the sentencing judge overstepped his authority by imposing a sentence that was too lenient. Friday’s ruling rendered that argument moot.

The case against Ravi prompted a national conversation about anti-gay bullying and teen suicide, and highlighted the pervasive effects and potential harm of social media. Friday’s ruling strongly criticized the acts that led to the charges against Ravi.

“The social environment that transformed a private act of sexual intimacy into a grotesque voyeuristic spectacle must be unequivocally condemned in the strongest possible way,” the judges wrote. “The fact that this occurred in a university dormitory, housing first-year college students, only exacerbates our collective sense of disbelief and disorientation.”

The Middlesex County prosecutor’s office, which tried the case and argued the appeal, didn’t immediately respond to a message seeking comment.

Tyler Clementi’s parents, who formed a foundation that addresses bullying and lesbian, gay, bisexual and transgender issues, said in an email the ruling “shows us how much more work there is to be done, and will push us forward with stronger determination to create a kinder, more empathic society where every person is valued and respected.”

During Ravi’s three-week trial, jurors heard that in September 2010 Ravi used a friend’s computer to view a few seconds of live streaming video from his own dorm-room webcam and saw his roommate, Clementi, and another man kissing.

He told others about it in person, in texts, instant messages and tweets, and alerted others again two days later that Clementi, 18, wanted the room to himself again. That time, the camera did not operate.

A night later, Clementi jumped off the George Washington Bridge.

Ravi’s attorney, Steven Altman, cited in his appeal a 2013 state Supreme Court ruling that made a victim’s perception of an alleged bias incident less important than the alleged perpetrator’s intent.

Prosecutors conceded one of the bias intimidation convictions should be overturned, but argued before the appellate judges the remaining counts should stand.