Meek Mill has pleaded guilty to a misdemeanour gun charge, in a plea deal which ends a 12-year long case.
The US rapper was granted a new trial in July because judges ruled that his original trial in 2008 had credibility issues with the arresting officer.
The judge in the new trial decided the two years Meek Mill had already spent in prison was enough.
“I know this has been a long road for you and hopefully this will be the end of it,” said Judge Leon Tucker.
Meek Mill, whose real name is Robert Rihmeek Williams, said the whole case had been “mentally and emotionally challenging”, but that other people in the US also face similar ordeals.
He’d originally gone to jail in 2009 after being arrested on gun and drug charges.
He was released on parole after five months and given a 10-year probation period.
Probation is often given as a sentence instead of time in prison and can include conditions like being on a curfew or going to rehab.
Parole is when an inmate is released early from prison with similar conditions to probation.