Brooklyn-based rapper Tekashi 6ix9ine struck a plea deal in his criminal case, agreeing to cooperate with federal investigators and admitting he paid someone to shoot a rival rapper “to scare him,” according to court documents released Friday.

Before Tekashi, whose real name is Daniel Hernandez, agreed to cooperate, he faced up to life in prison for his alleged crimes. As part of his agreement, Tekashi pleaded guilty on Jan. 23 to nine charges including racketeering conspiracy, firearms offenses, and violent crimes in aid of racketeering.

“In the fall of 2017, I met and joined the Nine Trey Blood Gang,” Tekashi, 22, told Manhattan U.S. District Judge Paul Englemayer, according to a transcript of the court proceedings obtained by The Daily Beast. “As a member of Nine Trey, the enterprise engaged in such activities including shooting at people, robbing people, and at times drug trafficking.”

“What was the thing after shooting? Shooting people?” Englemayer asked.

“Robbing people,” Tekashi replied.

The Nine Trey Gangsta Bloods are a subset of a violent gang that started in Rikers prison in 1993.

“As members of Nine Trey, we had disputes with rivals of Nine Trey, including disputes with our own members who we deemed disloyal to our organization,” the Bushwick-born rapper admitted. “We engaged in these various criminal acts to preserve and enhance the power of Nine Trey.”

As part of his time with the gang, Tekashi said, he participated in three gun-related crimes in the first half of 2018. “On or about March 20, 2018, I helped members of Nine Trey attempt to kill a rival gang member. I did this to maintain or increase my own standing in Nine Trey,” the 22-year-old said.

He also admitted to attempting to rob a Nine Trey rival 14 days later, on April 3, noting that “I helped other members of Nine Trey rob persons at gunpoint, and property was taken from the victims.”

And on June 2, he said, “I paid a person to shoot at a rival member of Nine Trey to scare him.”

That rival gang member is widely assumed to be Chief Keef, a rapper with whom Tekashi had traded barbs online. The single shot missed Keef and his cousin, a less-famous rapper known as Tadoe. Given the pair’s online beef, Tekashi had been the most prominent suspect in the attempted murder.

Tekashi also admitted to narcotics crimes, noting that in 2017, he helped sell a kilogram of heroin in Bushwick, Brooklyn, and also acknowledged that the group had trafficked fentanyl.

Tekashi’s plea led to a new, superseding filing from the U.S. Attorney’s Office for the Southern District of New York. It largely echoed the rapper’s statements in court, noting that the Nine Trey Blood Gang is “an organization whose members and associates” engaged in “murder, robbery, and narcotics trafficking.” The indictment added that the gang trafficked drugs including fentanyl, MDMA, and marijuana in multiple New York City boroughs.

Tekashi will now be sentenced on Jan. 23, 2020. As part of his cooperation, he agreed to help provide information on fellow gang members, which led to the indictment of three fellow gang members, one of whom allegedly participated in the Chief Keef shooting.

When the rapper was first arrested in November for allegedly conspiring to commit multiple racketeering and assault charges, he did not appear willing to cooperate with authorities. In December, his attorney Lance Lazzaro told Rolling Stone that under no circumstances would Tekashi assist investigators.

“Danny liked to present the image of being a gangster to sell his music,” Lazzaro told Rolling Stone’s Stephen Witt. “But my client is not a gangster."

This isn’t the first time he’s tangled with police. In 2015, Tekashi pleaded guilty to “use of a child in a sexual performance” after he posted a video of a naked 13-year-old girl performing a sex act on a friend while he thrusted behind her. In 2018, around the time of his other admitted crimes, he was reportedly arrested three times for driving with a suspended license, assaulting a police officer, and allegedly choking a 16-year-old who asked for his picture.