[What you need to know to start the day: Get New York Today in your inbox.]

The rapper and Instagram star known as Tekashi 6ix9ine has pleaded guilty to charges stemming from his role in a violent drug-trafficking gang and was cooperating with federal prosecutors, according to newly unsealed court records.

The rapper, whose legal name is Daniel Hernandez, admitted at a federal court hearing in Manhattan on Jan. 23 to being a member of the Nine Trey Gangsta Bloods, and said he had helped other gang members rob people at gunpoint. In one case, he said, “I helped members of Nine Trey attempt to kill a rival gang member.”

Mr. Hernandez added, “I did this to maintain or increase my own standing in Nine Trey.” He also said the gang engaged in “shooting at people, robbing people and, at times, drug trafficking.”

Mr. Hernandez said he apologized to the judge and “to anyone who was hurt, to my family, friends and fans for what I have done and who I have let down.”