Florida rapper Kodak Black has been sentenced to nearly four years in federal prison after pleading guilty to weapons charges stemming from his arrest at a May concert, according to local reports.

Black admitted in an August court filing that in two separate instances from earlier this year, he had lied about his criminal history while acquiring firearms. Lawyers for Black, who faced a maximum sentence of 10 years in prison, pointed to his need for self-defense and his willingness to take responsibility for his actions in arguing that he deserved fewer than the 46 to 57 months recommended by prosecutors. On Wednesday, U.S. District Court Judge Federico Moreno handed down a 46-month sentence.

“Young people do stupid things and I normally give them a break for that,” Moreno told Black, 22, per the Miami Herald. “The problem is that you have been doing stupid things since 15."

Black, who changed his legal name from Dieuson Octave to Bill Kapri, was arrested at the Rolling Loud Music Festival in May after law enforcement discovered he had twice lied on background forms while buying firearms, denying he had ever been “under indictment … in any court for a felony offense.” A semiautomatic rifle he purchased was recovered from the scene of a March shooting in Pompano Beach, Fla., just north of Fort Lauderdale. Another weapon was found in the trunk of a car in April as Black and his team tried to cross the border from Canada into Upstate New York.

Lawyers for Black referred to him in a court filing as a “latchkey kid,” pointing out that he grew up in a single-parent household in Pompano Beach’s Golden Acres housing complex, described in the documents as “one of the poorest and most disenfranchised neighborhoods” in the area. They argued that the rapper, who has been charged in multiple criminal cases and previously served time for violating his house arrest, became “a victim and product of his environment.”

Charges against Black have included drug possession, kidnapping and sexual assault, and some cases are still pending. In April, the Associated Press reported that he had been charged with first-degree criminal sexual conduct — and faces a maximum sentence of 30 years — for allegedly assaulting a high school student after a concert in Florence, S.C.

Reached for comment Wednesday, a lawyer for Black stated that the court had handed down a shorter sentence after being “apprised of all the facts and circumstances of this case and the good charitable work that Bill has done over the years,” noting he could be eligible for an early release.

Black earned a Grammy nomination in 2018 for co-writing Cardi B’s chart-topping track “Bodak Yellow.” His album “Dying to Live” debuted at No. 1 on the Billboard album chart later that year, and its hit single “Zeze,” featuring Travis Scott and Offset, peaked at No. 2 on the Billboard Hot 100.

On Wednesday, Black addressed the sentencing in an Instagram post shared with his 8.4 million followers.

“Hold It Down While I’m On Lock,” he wrote. “Calling Shots From The Box."