FILE - In this Aug. 27, 2017 file photo, Kodak Black arrives at the MTV Video Music Awards at The Forum in Inglewood, Calif. Rapper Kodak Black is expected to plead guilty to federal weapons charges. A hearing is set for Thursday, Aug. 22, 2019, in Miami federal court. The decision comes months after an original plea of innocence. Prosecutors in May charged the 21-year-old rapper for crimes that involve falsifying information on federal forms to purchase three firearms. (Photo by Jordan Strauss/Invision/AP, File)

FILE - In this Aug. 27, 2017 file photo, Kodak Black arrives at the MTV Video Music Awards at The Forum in Inglewood, Calif. Rapper Kodak Black is expected to plead guilty to federal weapons charges. A hearing is set for Thursday, Aug. 22, 2019, in Miami federal court. The decision comes months after an original plea of innocence. Prosecutors in May charged the 21-year-old rapper for crimes that involve falsifying information on federal forms to purchase three firearms. (Photo by Jordan Strauss/Invision/AP, File)

MIAMI (AP) — Rapper Kodak Black pleaded guilty on Thursday to federal weapons charges stemming from his arrest just before a scheduled concert performance in May.

Black entered the change of plea in a Miami federal court. Prosecutors charged him with crimes including falsifying information on federal forms to buy four firearms from a Miami-area gun shop on two separate occasions.

Black, 22, was able to obtain three of the weapons: a 9 mm handgun, a .380-caliber handgun and a semi-automatic Mini Draco weapon. Authorities said one of the guns was found at the scene of a March shooting in Pompano Beach.

ADVERTISEMENT

Black also faces drug, weapons and sexual assault charges in other states.

When U.S. District Judge Federico Moreno asked Black why he needed so many weapons, he shrugged and said he needed them for “protection.” In a previous hearing, his attorney, Bradford Cohen, said the rapper faced threats from gangs and other rivals.

Black is a Florida native who was born to Haitian American parents as Dieuson Octave and who now goes by the legal name of Bill Kapri.

He has been in federal custody since he was arrested during a Miami-area hip-hop festival in May that was marred by several violent incidents. Authorities are still investigating three unrelated shootings in the Miami area with possible connections to the festival, one of which involved a property owned by President Donald Trump.

Moreno previously denied Black’s request for bond, ruling that he was a danger to the community.

The rapper, known for the singles “ZeZe” and “Roll in Peace,” could face up to 20 years in prison and a $500,000 fine.

He is scheduled to be sentenced on Nov. 13.