(CNN) Kodak Black was arrested at the Rolling Loud hip-hop festival in Miami, right before he was set to perform, authorities said.

The Florida rapper, whose real name is Bill K. Kapri, was taken into custody Saturday for alleged state and federal firearm violations, said Roberto Gonzalez with the US Marshals Office of the Southern District of Florida.

He was arrested by US Marshals with the help of Miami-Dade police and federal agents from the US Bureau of Alcohol, Tobacco, Firearms and Explosives.

His arrest comes after an "extensive investigation," the Miami Herald reported , citing US Marshals.

Last month, the rapper was arrested on gun and drug charges near Niagara Falls, New York, while trying to enter the US from Canada.

Read More