Image copyright Getty Images

Meek Mill has been released from prison - five months after being sentenced for breaking the terms of his probation.

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

The 30-year-old was due to serve between two and four years but a court granted him bail due to the "credibility" concerns of a witness.

Beyonce, Jay-Z and comedian Kevin Hart were part of a campaign to free him.

Just hours after being released the rapper attended a basketball game in his home city of Philadelphia.

He was given the honour of ringing the ceremonial Liberty Bell which signals the start of the game.

Image copyright Getty Images Image caption Hours after being released Meek Mill attended a Philadelphia 76ers game where he was joined by comedian Kevin Hart

Another influential name behind the campaign to free Meek Mill was Michael Rubin - co-owner of the Philadelphia 76ers basketball team.

The billionaire picked the rapper up in a helicopter before the pair headed to the game.

Meek Mill, whose real name is Robert Williams, was arrested in August 2017 for reckless driving.

It happened while he was riding a dirt bike in New York filming a music video.

Although the charges were later dropped, a judge ruled the arrest itself was a breach of his probation.

He'd been on probation since 2008, when he was convicted on drug dealing and gun charges.

However, the decision to jail him last November came as a surprise.

His lawyers announced they were going to appeal, claiming he was being unfairly punished and that Meek Mill had turned his life around and was now a role model to others in a similar position.

A high profile campaign to free him began with stars like Jay-Z, Beyonce and Kevin Hart pledging their support to the rapper.

Meek Mill is signed to Jay-Z's Roc Nation management group.

A court now has 60 days to decide whether Meek Mill will face a new trial but prosecutors could also choose to completely drop the charges.

Meek Mill said his immediate plans are to "work closely with my legal team to overturn this unwarranted conviction" and resume his music career.

Meanwhile athletes, musicians and other celebrities have been welcoming the the rapper home.

Follow Newsbeat on Instagram, Facebook and Twitter.

Listen to Newsbeat live at 12:45 and 17:45 every weekday on BBC Radio 1 and 1Xtra - if you miss us you can listen back here.