1:23 PM PT -- According to the PA Supreme Court's official order, the justices cited the alleged corrupt police officer who served as a "critical witness" in Meek's original gun and drugs case as a crucial point in their decision to order his bail. It also said prosecutors were not opposed to him being released, and sided with them.

Meek Mill will be a free man in 1 hour ... out of prison after a long legal battle.

The Supreme Court of PA made the decision, overruling Judge Genece Brinkley. Judge Brinkley was severely criticized for what some say was a grudge against Meek and keeping him in prison, despite prosecutors asking that his conviction be overturned because of a dirty cop.

Judge Brinkley denied Meek bail last week after prosecutors asked her to toss the conviction, and instead she set a hearing for 60 days later. Many found that outrageous, and that apparently includes justices of the Pennsylvania Supreme Court.

The justices released Meek with no bail, pending a hearing in about 60 days to possibly dismiss the conviction. One remarkable thing, which is a clear diss to Judge Brinkley ... the justices refused to boot Judge Brinkley from the case, but said she "may opt to remove herself from presiding over this matter."

Meek tells TMZ ... "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."

"While the past five months have been a nightmare, the prayers, visits, calls, letters and rallies have helped me stay positive."

The rapper also hopped on a call with T.I. after his release ... T.I. posted a video of the call, and Meek sounds ecstatic. 

Meek adds, "To the Philadelphia District Attorney’s office, I’m grateful for your commitment to justice – not only for my case, but for others that have been wrongfully jailed due to police misconduct. Although I’m blessed to have the resources to fight this unjust situation, I understand that many people of color across the country don’t have that luxury and I plan to use my platform to shine a light on those issues. In the meantime, I plan to work closely with my legal team to overturn this unwarranted conviction and look forward to reuniting with my family and resuming my music career." 

Meek's lawyer, Joe Tacopina, says, "Meek was unjustly convicted and should not have spent a single day in jail. Meek is excited to be reunited with his family, and we, along with Meek, intend to continue to shine the light on a justice system in need of reform to prevent any other citizen from being put through what Meek has endured."