Rapper Tekashi 6ix9ine is testifying as the star witness in the government's racketeering case against two members of his old crew, the Nine Trey Gangsta Bloods.

The trial in Manhattan federal court kicked off on Monday, and the rapper, born Daniel Hernandez, took the witness stand for two hours on Tuesday.

He traded his usual loud outfits for a dark blue prison jumpsuit after the presiding judge issued a dress code.

Tekashi testified about the various acts of violence he says he witnessed while running with the gang, including shootings, assaults and drug trafficking.

He had pleaded guilty in the case in February and made a deal with prosecutors, agreeing to testify against his former confidantes, Anthony 'Harv' Ellison and Aljermiah 'Nuke' Mack, in exchange for avoiding a 47-year prison sentence.

Rapper Tekashi 6ix9ine testified as the star witness in the government's racketeering case against two members of his old crew, the Nine Trey Gangsta Bloods, on Tuesday

On Tuesday he identified Ellison and Mack as Nine Trey gang members.

Ellison is charged with kidnapping and robbing Tekashi in July 2018 and of assaulting a different Nine Trey member last fall.

Mack is charged with dealing heroin and MDMA.

Born Daniel Hernandez, Tekashi agreed to testify against his former confidantes, Anthony 'Harv' Ellison and Aljermiah 'Nuke' Mack, under a plea deal with prosecutors in February. The 23-year-old is pictured in court after his arrest in November 2018

The jury was shown clips from three of Tekashi's music videos, in which he raps about drugs, sex, murder.

Prosecutors say proceeds from his songs helped fund the gang's operations.

Tekashi testified that he never underwent a gang initiation or personally shot anyone.

He said the gang kept him around because of his lucrative career.

It's unclear how much weight Tekashi's testimony will have given his long rap sheet.

He is currently being housed in a federal facility for his own safety.

Tekashi entered the courthouse through a secure tunnel and flaked by US Marshals.

Prosecutors have previously suggested that he could be moved into witness protection after his testimony.

Tekashi publicly distanced himself from the gang days before he and alleged fellow members were arrested in November 2017. The day after his arrest, he cut a deal with prosecutors, he told the court.

The falling out was reportedly precipitated by his kidnapping last summer, which Ellison is accused of orchestrating as part of a power-struggle over Tekashi's fame.

Tekashi pleaded guilty in the racketeering case in February, admitting in court that he was a member of Nine Trey, a gang which he said engaged in 'shooting at people, robbing people and, at times, drug trafficking'

Known almost as much for his tattooed, rainbow-haired look as for his music, Brooklyn-born Tekashi was a social media phenomenon before becoming an ascendant name in hip-hop.

He has 15.5 million followers on Instagram and his album Day69: Graduation Day was among the top-sellers on iTunes following its February release.

Tekashi had a multiplatinum hit song, 'Fefe,' with Nicki Minaj, which peaked at number three on the pop charts, and 'Stoopid,' featuring the incarcerated rapper Bobby Shmurda.

His drive for success has been studded by a series of run-ins with the law believed to have increased his notoriety.

In May 2018 he pleaded guilty in Brooklyn to disorderly conduct in connection with a traffic stop.

In 2015, he was sentenced to probation for appearing in a video in which a 13-year-old girl performed a sex act on another man.

In court proceedings, Tekashi has suggested that his brash stunts and penchant for violence - including his involvement in Nine Trey - were all part of his effort to bolster his 'bad boy' public persona.