Louisiana rapper Lil Boosie (born Torrence Hatch) pleaded guilty to a third-offense marijuana possession charge on Tuesday and was sentenced to two years in prison. The plea deal came just one day before the MC’s latest album, Superbad: The Return of Boosie Bad Azz, debuted in the top 10 on the Billboard albums chart.

According to Baton Rouge station WBRZ, Boosie will serve at least one year in prison after prosecutors reached an agreement with his lawyers in which all but two years of a 10-year sentence were suspended. The rapper will also be on active supervised probation for two to five years after his release from prison. If he completes his probation, the gun charge will be dropped.

“I’m ready to get this behind me,” Boosie, 25, told Judge Chip Moore one week before he was scheduled to stand trial in connection with his October 22 arrest. During the incident, East Baton Rouge sheriff’s deputies found a bag of marijuana, a cigar loaded with weed and another unspecified drug and a gun in a car driven by Boosie. At the time, he was charged with third-offense possession of marijuana, punishable by up to 20 years in prison, as well as possession of a firearm with a controlled dangerous substance, a crime that carries a mandatory minimum five-year prison term.

The judge set a November 9 sentencing date and strongly warned Boosie to stay out of trouble and away from drugs, guns and convicted felons between now and his sentencing, according to WBRZ. If the rapper is rearrested, tests positive for drugs or fails to show up for his November sentencing date the judge warned the consequences will be harsh.

“When I do catch up with you, I can assure you I will not abide by this agreement of 10 years. It will be much more,” Judge Moore told Boosie.