This post has been updated. 

The Pennsylvania Supreme Court ordered Tuesday that rapper Meek Mill immediately be granted bail, a move that came after a judge in November sentenced him to two to four years in prison for a probation violation.

“I’d like to thank God, my family, and all my public advocates for their love, support and encouragement during this difficult time,” reads a statement posted to the rapper’s Twitter account just after 4 p.m. “While the past five months have been a nightmare, the prayers, visits, calls, letters and rallies have helped me stay positive.”

The high-profile case of Meek Mill, born Robert Rihmeek Williams, had sparked an outcry among fellow entertainers and within the hip-hop world. His probation violations stemmed from a 2008 drug and gun conviction, for which he served eight months. He had since been in and out of Common Pleas Court Judge Genece E. Brinkley’s court for violating probation rules. But in November, the city prosecutor didn’t recommend imprisonment, saying the rapper had been clean from drugs and shown personal growth since the original crime.

So Brinkley’s sentence came as a surprise, and it prompted condemnation from Jay-Z and others. “The sentence handed down by the Judge — against the recommendation of the Assistant District Attorney and Probation Officer — is unjust and heavy handed,” Jay-Z wrote on Facebook. He elaborated days later in a New York Times op-ed.

“What’s happening to Meek Mill is just one example of how our criminal justice system entraps and harasses hundreds of thousands of black people every day,” the rap mogul wrote. “I saw this up close when I was growing up in Brooklyn during the 1970s and 1980s. Instead of a second chance, probation ends up being a land mine, with a random misstep bringing consequences greater than the crime.”

On Tuesday, Mill directed more comments to the Philadelphia District Attorney’s Office:

The comments from the Pennsylvania Supreme Court docket on Tuesday read that the Court of Common Pleas “is DIRECTED to immediately issue an order releasing Petitioner on unsecured bail,” the conditions of which are similar to those of Mill’s probation before Aug. 1, 2017. The docket addresses “credibility issues” with Mill’s arresting officer, Reginald Graham, who had also accused Mill of pointing a gun at police. Graham stole money in a drug bust two years before arresting Mill in 2007 and then lied about it to the FBI, according to a report obtained by the Philadelphia Inquirer. Graham has since retired.

Graham was the only police officer to testify against Mill in the 2008 trial, the Inquirer reported. Graham’s former colleague Jerold Gibson, also involved in Mill’s arrest, then filed a court affidavit in February that accused Graham of lying under oath during the trial. Earlier this month, Brinkley had responded to the Philadelphia District Attorney’s Office request for a new trial by setting a hearing for June.

Recent research shows that black men who commit the same crimes as white men receive sentences nearly 20 percent longer. (Victoria Walker/The Washington Post)

The Pennsylvania Supreme Court order came the same day that actor Kevin Hart and 76ers co-owner Michael Rubin visited Mill in prison. Hart told reporters Tuesday that the sentence had resulted from Brinkley’s “personal vendetta” against the rapper.

“I’m not going to sit up here and say he’s an angel,” Hart said of Mill. “He has done wrong. In doing wrong, he has paid for it — he has done his time. He’s been there, he’s done that for this particular case.”