NEW YORK — Two men were convicted Thursday in a racketeering case featuring the testimony of Tekashi 6ix9ine, the rapper whose decision to cooperate put him in danger while in jail and made him a target of social media ridicule by other artists labeling him a "snitch."

The Brooklyn-born Tekashi 6ix9ine, whose legal name is Daniel Hernandez, had pleaded guilty earlier this year to charges accusing him of joining the Nine Trey Gangsta Bloods, a violent street gang founded on Rikers Island. As part of a plea deal, he agreed to take the stand as a key government witness against two-high ranking members at a trial in federal court in Manhattan.

The 23-year-old rapper's cooperation could earn him a break at sentencing. It might also make him eligible for a witness protection program, though his distinctive facial tattoos — including a large "69" on his forehead — could make concealing his identity a challenge.

Last year, Tekashi 6ix9ine had a multiplatinum hit song, "Fefe," with Nicki Minaj, which peaked at No. 3 on the pop charts, and "Stoopid," featuring imprisoned rapper Bobby Shmurda.

In testimony last month, Tekashi 6ix9ine explained to jurors that his role in Nine Trey was to "just keep making hits and be the financial support for the gang ... so they could buy guns and stuff like that." Asked what he got in return, he responded: "My career. I got the street credibility. The videos, the music, the protection — all of the above."

The witness testified that after having a dispute with defendant Anthony Ellison, the defendant and another man forced him into a stolen car at gunpoint. He said the men drove him around, stopping at various points to beat and taunt him as he begged for his life.

The men ultimately took him to his Brooklyn home, where they stole a bag full of jewelry before driving him a few blocks away and releasing him, he said.

Tekashi 6ix9ine was relentlessly trolled during the trial by rappers like The Game and Snoop Dogg, who wrote on Instagram that he was a sellout compared to his friend Martha Stewart, who once served a five-month prison term for lying about a stock sale.

"As we watch Tekashi 69 (or whatever his name is) snitch on EVERYBODY," he wrote, "I invite you all to remember Martha Stewart snitched on NOT ONE soul during her trial."

According to one of his lawyers, Tekashi 6ix9ine has been housed at an undisclosed federal lockup that had to separate him “from people who threatened him.”