Rapper Tekashi69—who partnered up with the Nine Trey Gangsta Bloods, a notorious New York City street gang, as he rose to fame—was sentenced Wednesday to 24 months in prison followed by five years of supervised release after flipping on his former crew.

Clad in a navy prison jumpsuit, the 23-year-old rainbow-haired rapper, who faced the possibility of life in prison, made an emotional statement before he was sentenced in Manhattan federal court after pleading guilty in January to nine federal crimes, including racketeering and drug charges, under a cooperation deal with the feds.

“I am not a victim,” he said, choking up as he spoke. “I put myself into this position from day one. I allowed them in. That was my decision.”

The Brooklyn-born rapper, whose real name is Daniel Hernandez, added that he wants to “inspire the youth that it never too late to change.”

“Your Honor, allow me to inspire people. Not only the young people here, but the millions around the world listening and watching,” he said, leaning over the defense table as he spoke to the judge.

Prosecutors had urged Judge Paul Engelmayer to show him leniency for his “incredibly significant and extremely useful” September testimony in the trial against his former gang associates.

While Engelmayer praised his “courageous” cooperation, Engelmayer said he ultimately could not let the rapper, who’s already spent 13 months in prison, off the hook with a sentence of time served.

“In my judgment, your conduct is too violent and selfish to make 13 months reasonable,” he said, before listing off the various crimes Tekashi copped to as part of his guilty plea, including attempting to murder a rival rapper.

“Apart from the number and vengefulness of these attacks, there’s also that they were to benefit you,” Engelmayer added. “Before you, the gang didn’t fight with rap entourages. They had no independent interest in going after musicians and their management groups.”

As part of his sentence, Tekashi must also complete 300 hours of community service and pay a fine of $35,000 in addition to the 24 months of prison time—which includes the months the rapper has already served.

Tekashi appeared stoic as the sentence was read, looking down as the judge described the next steps in the judicial process.

During his three-day trial testimony, the rapper linked two alleged gang members, 33-year-old Aljermiah “Nuke” Mack and 31-year-old Anthony “Harv” Ellison, to several crimes and admitted to participating in “robberies, assaults, drugs.” Both men were later convicted of racketeering conspiracy charges.

At his sentencing, an innocent bystander who was shot in the foot during an incident involving the gang testified before the court about the pain she suffered.

“At the end of the day, he was the mastermind,” the victim, identified only as L.L., said. “I have bruises on me. I have to look at myself. I just want an apology. It took a lot of me to come here. I want to face him. I want him to know he hurt me. He hurt me!”

Tekashi later apologized directly to the woman as she wrapped her arms around herself and nodded, offering to pay for her medical bills.

While on the witness stand, Tekashi detailed the symbiotic relationship he established with the Nine Trey bloods: The gang gave him protection and street credibility, and in exchange, he funded their illicit activities.

“My role was, just keep making hits and be the financial support for the gang,” he said in September in front of a packed courtroom. “I got the street credibility. I would say I got my career.”

The relationship ended less than a year later as his fame grew, however, and the group devolved into dangerous infighting. It became so toxic that one of his former associates even kidnapped him and forced him to turn over thousands of dollars in jewelry—including a diamond-encrusted necklace of a pony with rainbow hair like his own, the rapper said.

“I was so humiliated,” he testified. “Humiliated because I constantly brag that I am untouchable and invincible on Instagram. Then I get kidnapped by a brother.”

Tekashi69 became a viral social-media star in 2014 thanks to his extreme music videos on Instagram and Youtube that featured guns, drugs, and various allusions to the Bloods gang. After several years as a SoundCloud-rapper, the 22-year-old entered the mainstream music scene with “FEFE,” his hit single that he co-wrote with Nicki Minaj last year.

The rapper told jurors that he was first introduced to the street gang in 2017 while filming a music video for his first single, “GUMMO.” After learning his former manager had a gang affiliation, he “asked if Nine Trey members would be in the video” because he wanted their “aesthetic,” he said.

The video—which featured dozens of Nine Trey members toting guns and wearing the Bloods’ signature color, red—was such an “instant success” that he used gangster imagery again in a video for his hit “KOODA” a month later.

“I knew I had a winning formula for my music videos: repeat the gang image. That’s what people liked,” he testified, adding that after the second music video he was “officially a Nine Trey member.”

Tekashi said that although he participated in a number of crimes—including filming an armed robbery in Times Square and paying another Nine Trey member to shoot a rival rapper—he was mostly valued because he gave the gang access to his bank account. But as his career skyrocketed, he said the Nine Trey Bloods soon disintegrated into two camps: those with the Brooklyn rapper and those against him.

“We were all part of the same gang, but we were all attacking each other at the same time,” he said.

The bad blood overflowed the night before Tekashi’s single “FEFE” was set to drop last July, when Ellison kidnapped and robbed him after the rapper stopped giving him money, he said.

After slamming into his car, Ellison and another assailant allegedly beat him up, swiped more than $300,000 in jewelry from him, and kidnapped him for hours, Tekashi said. Dash-cam video played in court showed Tekashi pleading with Ellison to spare him as he was being dragged from his car, reminding him: “I’ve always done right by you.”

Shortly after the robbery, Tekashi publicly denounced the Brooklyn-based crew on the radio, calling them “frauds” and “dirty Bloods members.”

Weeks later, the rapper and a dozen other alleged gang members were indicted on racketeering charges. The day after he was arrested, Tekashi said, he decided to cooperate with the feds to “shed light on the whole operation.”

In a Dec. 11 letter to Judge Engelmayer, Tekashi expressed remorse for his previous gang affiliation and misdeeds, and said he was “becoming more and more overwhelmed with emotions” as his sentencing approached.

“There is no excuse, no justification, and no apology is good enough in this world to explain my crimes,” the rapper wrote. “I know my life will never be the same but hopefully this change will be for the better because beyond all of this, I still consider myself a role model to millions of people as an artist, a celebrity, and as a human being.”

After Tekashi reiterated similar sentiments on Wednesday, a man who claimed to be the rapper’s biological dad—who he has not seen since 3rd grade—stood up and asked to speak on the rapper’s behalf. The disruptive request, which garnered mummers throughout the courtroom, was denied.

Tekashi looked straight ahead throughout the shocking admission.

“I want to tell him I love him and that I miss him,” Daniel Hernandez, 58, told The Daily Beast outside of the courthouse. “I came to see my son.”