The Florida rapper Kodak Black was sentenced on Wednesday to 46 months in prison on federal weapons charges, though he faced up to 10 years. Prosecutors in Miami had asked for a sentence of 46 to 57 months, while Black’s lawyers had requested less, pointing to his guilty plea in August and his history of charitable work.

Black, 22, whose legal name is Bill Kapri (though he was born Dieuson Octave), had admitted to lying on background check forms while buying multiple firearms in two different incidents earlier this year. Prosecutors said two of the guns were later found by the police at crime scenes, including one — with Black’s fingerprints and a live round in the chamber — that had been used to fire at a “rival rap artist.” Black has not been charged in the shooting.

Another weapon was discovered in the trunk of a car as the rapper and his team attempted to cross the Canadian border into upstate New York in April. Black was charged with unlawful possession of marijuana and criminal possession of a firearm.

Lawyers for Black did not immediately respond to a request for comment on Wednesday.

In court, Black apologized and told the judge, “I do take full responsibility for my mishap,” The South Florida Sun Sentinel reported.