NEW YORK (AP) — Up-and-coming rapper Bobby Shmurda pleaded guilty Friday to charges accusing him of conspiring with a New York City gang involved in violent drug wars.

FILE - In this Oct. 30, 2014 file photo, Bobby Shmurda performs at Power 105.1's Powerhouse 2014 at the Barclays Center in the Brooklyn borough of New York. Shmurda pleaded guilty Friday, Sept. 9, 2016, to conspiracy and illegal weapon possession. Authorities say a minimum seven-year sentence is required by his plea deal. (Photo by Scott Roth/Invision/AP)

In this Oct. 30, 2014 file photo, Bobby Shmurda performs at Power 105.1’s Powerhouse 2014 at the Barclays Center in the Brooklyn borough of New York. Shmurda pleaded guilty Friday, Sept. 9, 2016, to conspiracy and illegal weapon possession. Authorities say a minimum seven-year sentence is required by his plea deal. (Photo by Scott Roth/Invision/AP)

Under a plea deal, he will face a minimum term of seven years in prison at sentencing on Oct. 19. The plea allowed him to avoid going to trial next week on multiple drug and weapons charges carrying penalties that could have put him away for decades.

The Brooklyn-born performer, whose birth name is Ackquille Pollard, is best known for the hit song “Hot Boy.” He also put out a music video that popularized a dance craze called the “Shmoney dance.”

Police arrested Shmurda in late 2014 after he left a recording studio near Radio City Music Hall. Officers found two handguns and a small amount of crack cocaine in a car in which he was riding, authorities said.

Court papers accused the rapper of firing a gun toward a crowd of people outside a barbershop in Brooklyn in 2014. They also said he was present last year during a confrontation between rival drug gangs outside a Brooklyn courthouse where shots were fired.