(CNN) Meek Mill has been released from prison.

After spending nearly five months incarcerated after a controversial sentence for violating probation, the Philadelphia rapper was out and en route to a basketball game on Tuesday evening. The Pennsylvania Supreme Court ordered an immediate release for Mill earlier in the day, directing the judge to release him on "unsecured bail."

"I'd like to thank God, my family, my friends, my attorneys, my team at Roc Nation including JAY-Z, Desiree Perez, my good friend Michael Rubin, my fans, The Pennsylvania Supreme Court and all my public advocates for their love, support and encouragement during this difficult time," the rapper, whose full name is Robert Rihmeek Williams, said in a statement obtained by CNN. "While the past five months have been a nightmare, the prayers, visits, calls, letters and rallies have helped me stay positive."

Philadelphia 76ers co-owner Michael Rubin, a vocal supporter of Mill, shared an Instagram photo of Mill on the way to a 76ers game on Tuesday night.

Mill received a two-to-four year prison sentence in November for violating probation on a 2008 gun and drug case. (He was arrested in 2017 after being involved in a fight and arrested again later for popping wheelies on a dirt bike.) Judge Genece Brinkley cited a failed drug test and the rapper's noncompliance with a court order restricting his travel in her sentencing order.

Read More