YoungBoy Never Broke Again received a suspended 10-year prison sentence and three years of probation for his involvement in a non-fatal drive-by shooting last year.

According to the Advocate, the rapper received the sentence Tuesday, about eight months after he was charged with two counts of attempted first-degree murder. He later pleaded guilty to a reduced charge of aggravated assault with a firearm—a deal that District Judge Bonnie Jackson called lucky.

“I wasn’t very happy with the circumstances of your case, not at all,” the judge said to YoungBoy during Tuesday’s hearing.

“I take full responsibility for what happened. I’m sorry,” the 17-year-old responded. “It wasn’t supposed to go that way.”

"Fortunately, you all were bad shots," Jackson said.

YoungBoy was accused of hopping out of a vehicle and firing gunshots into a crowd on Nov. 2, 2016, in Baton Rouge, Louisanna. Though no one as killed, a passenger in the car YoungBoy was riding suffered a gun shot to the neck. Judge Jackson expressed her disappointment in the rapper’s actions and encouraged him to use his music to improve his community, rather than contribute to its problems.

“You know how much killing is taking place in New Orleans [where he now lives]. Baton Rouge isn't much better. That's the environment we're living in,” she explained. “"Your genre has a lot to do with the mindset people have. Your genre has normalized violence.

“I don't judge you for being a rapper,” Jackson said, adding the up-and-coming artist had an “obligation” to his fans.

YoungBoy promised he would change and do better for his family. Attorney James Manasseh told the judge his client has already begun to give back by donating school supplies to children as well as purchasing a home for his mother.

“I genuinely find him to be a good-hearted, kind, sweet young man," Manasseh said.

YoungBoy was also fined $5,000 and sentenced to 250 hours of community service, which will include an anti-violence PSA.

The sentencing comes just several weeks after the release of YoungBoy’s latest mixtape, AI YoungBoy, and just a day after the New York Times called him “one of the most promising young Southern rappers of the past couple of years.”