(Reuters) - Meek Mill, a rap artist from Philadelphia who has become an advocate for reform of the U.S. criminal justice system, is entitled to a new trial on drugs and weapon charges that have kept him on probation for a decade, a Pennsylvania appeals court ruled on Wednesday.

A three-judge Pennsylvania Superior Court panel agreed that Philadelphia Judge Genece Brinkley, who presided over a 2008 trial that resulted in his conviction, was no longer impartial, as Meek Mill’s attorneys have argued. It ordered a replacement for Brinkley in the case.

After the sentence, Meek Mill, an African-American whose given name is Robert Rihmeek Williams, became a cause célèbre for musicians, celebrities and criminal justice reform campaigners who said his case was typical of a U.S. legal system that treats minorities unjustly.

The sole witness against Meek Mill at his 2008 trial was a discredited Philadelphia narcotics squad officer who is no longer with the city’s police force.

“Williams’ right to be tried before an impartial judge is necessary in this case because the trial judge heard highly prejudicial testimony at the first trial, which was a bench trial, and made credibility determinations in favor of a now discredited witness and against Williams,” President Judge Jack A. Panella wrote in an 18-page opinion.

In November 2017, Brinkley sentenced the rapper to up to four years in prison, saying a pair of arrests violated probation conditions she set following his 2008 convictions. He served five months before the state’s top court granted him bail.

Neither of the arrests, including one that according to local media stemmed from a dirt bike stunt in New York, resulted in convictions.

Slideshow ( 2 images )

“The past 11 years have been mentally and emotionally challenging, but I’m glad that justice prevailed and my clean record has been restored,” Mill said on Twitter.

The Philadelphia District Attorney’s Office said in a statement it welcomed the appeals court decision and was reviewing its options regarding a new trial.

Chuck Peruto, an attorney for Judge Brinkley, said it was unusual for the district attorney to agree that a defendant deserves a new trial. Brinkley stands by her handling of the case.

“Basically, she’s a tough judge and any defendant would want a judge other than Brinkley to hear their case,” Peruto said by phone.

Mill’s song “Going Bad,” on which he collaborated with Drake, hit No. 6 on the U.S. charts this year. His other hit songs include “All Eyes on You,” and “Dangerous.”