US rapper Kodak Black has been sentenced to 46 months in prison after pleading guilty to weapons charges.
The 22-year-old, who had a US number one album last December, admitted falsifying information on background forms to buy four guns.
He was arrested before his set at Miami's Rolling Loud festival in May.
One of the guns he bought was used in an attempted shooting in March. Prosecutors said "a rival rap artist was the intended target".
However, he has not been charged in relation to that shooting.
Real name Bill K Kapri, the hip-hop star faced a maximum of 10 years in prison, and prosecutors had pushed for a sentence of eight years. The court heard he was alleged to have beaten up a prison guard while awaiting sentencing.
US District Judge Federico Moreno acknowledged that Black had made anonymous donations to charity in the past.
Black's lawyer Bradford Cohen told BBC News: "After the court was apprised of all the facts and circumstances of this case and the good charitable work that Bill has done over the years, the court rejected the government's request of 96 months and sentenced Bill to 46 months."
The MC has had a number of legal charges and spells in prison in recent years, and is known for his violent lyrics.
His debut studio album Painting Pictures went to number three in the US in 2017.
The follow-up went to number two, and a third album, Dying to Live, reached number one last December. Two hit singles - Zeze and Tunnel Vision - have reached the Billboard top 10.