East Flatbush rapper Bobby Shmurda, who has been held in jail since his arrest 20 months ago, pleaded guilty to gun possession charges today to avoid going to trial on a litany of gun, drug, and conspiracy charges in connection with his alleged role in the GS9 Crips street crew.

Shmurda, legal name Ackquille Pollard, was being held on $2 million bail—nearly twice the amount that's normal—on charges of conspiracy, reckless endangerment, gun possession, and use of drug paraphernalia. Earlier this year, he sued the city over what he claimed was a false arrest.

A TMZ producer overheard Bobby Shmurda's attorney telling him and the other defendants in the case to take the deal because they were unlikely to get a sympathetic jury and were facing 25 years to life in prison. Prosecutors argued that the entertainer was the "driving force" behind the G-Stone Crips, and that the crew was responsible for several shootings in Brooklyn.

Last year, the rapper was accused of asking his girlfriend to smuggle a shiv into Rikers for him.

As part of his deal, Shmurda pled guilty to fourth-degree conspiracy to possess weapons and second-degree criminal possession of a weapon, while the other charges were dismissed. Two co-defendants, Chad Marshall, better known as rapper Rowdy Rebel, and Nicholas McCoy also pleaded guilty to the same charges—under the terms of the deal, they all had to accept the bargain, or none would be able to, Pitchfork reports.

Shmurda and Rebel were arrested with six other alleged crew members at the Quad Recording Studios near Rockefeller Center in December 2014. Police say they found 21 weapons on them, including two guns and a small amount of crack in Shmurda's car. Among the litany of allegations against the young men, police accused Rebel of being the driver in a shooting in Boerum Hill with associate Santino Broderick as triggerman, then performing at the Barclays Center hours later wearing the same outfit as he had during the crime.

According to the terms of his deal, Shmurda will have to serve seven years in prison and five years of probation, but the 20 months he's spent behind bars will count towards his time.