Updated

Bobby Shmurda, an up-and-coming rapper featured in a viral music video that popularized the "Shmoney dance," pleaded guilty on Friday to conspiring with a drug gang responsible for several shootings.

Under a plea deal, Shmurda will face a minimum seven years in prison at sentencing on Oct. 19. The plea allowed him to avoid going to trial starting next week on multiple counts carrying penalties that could have put him behind bars for decades.

The Brooklyn-born Shmurda, whose birth name is Ackquille Pollard, is best known for "Hot Boy," a gritty hit song with rhymes about street violence.He and Chad "Rowdy Rebel" Marshall — another aspiring hip-hop artist who also pleaded guilty in the same case — gained notoriety with their performance in the "Shmoney dance" video, which has nearly 15 million Youtube views.

The two were among four co-defendants who were brought into a Manhattan courtroom in handcuffs on Friday and put side-by-side in the jury box, where they squabbled with their lawyers over whether to take the plea offer. After three accepted, Shmurda slumped down, stared toward the ceiling and, when prompted by the judge, mumbled "guilty."

Shmurda, 22, could get enough credit for time served and good behavior "to be home in approximately 3 ½ years and resume his remarkable career," defense attorney Alex Spiro said in statement.

Authorities arrested Shmurda in late 2014 after he left a recording studio near Radio City Music Hall, only days after he peformed "Hot Boy" for a national television audience on "Jimmy Kimmel Live." Investigators found two handguns and a small amount of crack cocaine in a car in which he was riding, authorities said.

An indictment charged Shmurda and more than 15 defendants with a variety of crimes including murder, attempted murder, assault and drug dealing. Shootings by the gang left one rival dead, injured an innocent bystander sitting on folding chair outside a Brooklyn home and caused pandemonium outside a nightclub in Miami Beach, Florida, authorities said.

The court papers alleged that Pollard once fired a gun toward a crowd of people outside a barbershop in Brooklyn. They also said he was present last year during a confrontation between rival drug gangs outside a Brooklyn courthouse where shots were fired.

In a jailhouse interview last year with The New York Times, Shmurda criticized his label, Epic Records, for not helping him pay his $2 million bail. Epic hasn't comment.

He also claimed his lyrics about gunplay were "fabricated," because "that's what's selling nowadays."