Rapper Kodak Black has pleaded guilty to federal weapons charges.

Black entered the change of plea in Miami federal court on Thursday, months after he had pleaded not guilty.

Prosecutors in May charged the 22-year-old rapper for crimes including falsifying information on federal forms to purchase three firearms.

Prosecutors say a weapon purchased by Black was found at the scene of a South Florida shooting.

Authorities say he could face up to eight years in prison.

A federal judge denied his request for bail, saying he was a danger to the community based on his lengthy criminal record.

Black has remained in a federal detention centre in Miami since his arrest.

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

He is known for the singles ZeZe and Roll In Peace.