CNN  — 

Tekashi 6ix9ine, the flamboyant Brooklyn rapper who carried out a series of violent crimes before informing on his former gang associates, was sentenced to 2 years in prison on Wednesday.

He had pleaded guilty to racketeering, firearms and drug trafficking charges related to several shootings and assaults around New York City. He was also sentenced to five years supervised release plus 300 hours of community service. Because he has already served about 13 months behind bars, he is due to be released late next year.

In making the decision, Judge Paul Engelmayer said that Tekashi 6ix9ine, born Daniel Hernandez, was a “central figure in a vicious and brutal gang.” Engelmayer said he caused mayhem around the city and used the gang as his “personal hit squad.”

However, Engelmayer balanced those crimes with the rapper’s extensive cooperation with government investigators. Prosecutors had requested that he receive a reduced sentence because of his “extraordinary” and “substantial” cooperation.

His attorney Lance Lazzaro had asked the court to sentence him to time served, highlighting the risks that Hernandez took in cooperating with the government. Hernandez provided investigators with an “insider’s view” of the Nine Trey gang, Lazzaro wrote in court filings, and even testified against two former gang members.

In court, Hernandez spoke of his remorse and how he failed the young fans who look up to him. He stressed that he’d change his ways when he’s out of prison. He also directly apologized to a woman who told the court that she was shot in the foot in a July 2018 shooting in Brooklyn.

“I’m sorry for what happened to you that day,” Hernandez said.

Tekashi 6ix9ine, real name Daniel Hernandez, leaves court on August 22, 2018, in Houston, Texas.

Tekashi 6ix9ine’s startling rise and dramatic fall began when the 23-year-old burst onto the rap scene with “GUMMO”and its music video in October 2017. With 360 million views on YouTube, the video shows the rainbow-haired, face-tattooed rapper surrounded by guns, drugs, stacks of cash and a group of people wearing red, the color associated with the Bloods gang.

But Hernandez was not actually a gang member when that video was made. He has said he used the Nine Trey gang to boost his street cred, and in exchange, he helped fund the gang’s operations, according to the government sentencing memo.

After the success of “GUMMO,” which peaked at No. 12 on the Billboard Hot 100, he continued making music and collaborated with Nicki Minaj on their 2018 song “FEFE.”

6ix9ine apologized for ‘misrepresenting myself’

But his career came to a screeching halt last November when he was charged alongside other alleged members of the gang known as Nine Trey Gangsta Bloods with serious federal offenses including racketeering.

US Attorney for the Southern District of New York Geoffrey S. Berman said the gang “wreaked havoc on New York City, engaging in brazen acts of violence.” Prosecutors said in court filings that he and other gang members carried out a March 2018 shooting in Times Square, an April 2018 shooting at the Barclays Center, a June 2018 shooting at the W Hotel in Times Square, and more.

Hernandez pleaded guilty to nine charges in February, including racketeering, and informed on his associates, according to court documents. He testified as a witness during the trials of Anthony Ellison and Aljermiah Mack, who were both convicted of felonies, Lazzaro wrote.

In a letter to the judge filed last week, he apologized for his crimes, for joining the gang and for “misrepresenting myself” to his fans.

“I now know that I am remorseful for what happened because I was blessed with the gift of an opportunity that most people dream of but I squandered it by getting involved with the wrong people and misrepresenting myself when I should have been true to myself and my fans,” Hernandez wrote.

“I’m sorry to the victims who were affected by my actions, to my fans who look up to me and were misled, to my family who depends on me and to this courtroom for this mess that I contributed to.”

Lazzaro portrayed Hernandez as a young man who joined the Nine Trey gang to promote his rap career and support his family.

“Mr. Hernandez is a rap artist who foolishly joined the Nine Trey Gansta Bloods (hereinafter “Nine Trey”) in an attempt to promote a gangster persona which would help him sell his music and advance his career,” Lazzaro wrote in the filing.

Two victims of an April 2018 armed robbery filed victim impact statements to the court saying that the attack, orchestrated by Hernandez, had caused severe stress and left them in constant fear for their lives.

“Why should this person, who nearly ended my life, be free when I am not free?” one victim, an unnamed 33-year-old man, wrote in court filings.

Hernandez was previously arrested in 2015 for filming a 13-year-old performing sex acts and posting the video to Instagram, according to the government’s sentencing memo. He pleaded guilty to use of a child in a sexual performance and was sentenced to probation, prosecutors said.