Rainbow-haired rapper Tekashi 6ix9ine may act tough in his videos or when he’s trolling people online. He may also have said in a recent interview that he’s “homies” with both the Crips and the Bloods in his Brooklyn neighborhood.

But the heavily tattooed “Gotti” singer found himself on the wrong end of threats by members of another notorious street gang after he was arrested last week by New York City police on an outstanding warrant for misdemeanor assault out of Houston, Texas, the Daily News reported.

While in central booking, waiting for a bail hearing, members of the Trinitarios gang called the 22-year-old a “b—-” and vowed “to cut him,” courthouse sources told the Daily News. Tekashi cowered in fear during the verbal onslaught, one of the sources said.

In an interview with TMZ Tuesday night, Tekashi acknowledged that he was “so scared” in custody, because other inmates tried to “kill me” and “slit my throat.”

If nothing else, the threats finally gave Tekashi grounds for a temporary reprieve from custody.

A Manhattan judge initially denied him bail last week, ignoring his pleas that, among other things, he’s the sole support of his mother and 2-year-old daughter. The judge called him a “flight risk” and said he’d have to remain in Rikers Island until Texas authorities could pick him up.

Tekashi was housed in a special unit, used for inmates battling contagious illnesses or high-profile prisoners in need of special protection, TMZ reported. But by late Friday, the judge “acknowledged a significant change in circumstances” and allowed him to be released on $150,000 bail.

According to reports, the Trinitarios gang is composed of teen and young adult Dominican Americans who live in neighborhoods in New York and New Jersey. Members or associates have been investigated or charged in shootings, stabbings, federal racketeering, narcotics and firearms offenses, according to U.S. Immigrations and Customs Enforcement. Preet Bharara, the former U.S. Attorney for the Southern District of New York, said in a statement in 2011: “Gangs like the Trinitarios are a cancer on New York’s neighborhoods both in the physical harm they inflict and the atmosphere of despair they create.”

Get more celebrity news and photos delivered to your inbox for free on weekdays.

Sign up for our Coffee Break newsletter here.

Seemingly chastened by his encounters with the menacing gangsters, Tekashi kept his word to the court and flew down to Texas to turn himself in to authorities in Harris County just after midnight Monday. Tekashi, whose real name is Daniel Hernandez, is charged with grabbing the neck of a 16-year-old fan who had taken out his phone to record him on video. Tekashi posted $5,000 bail, was released and presumably headed back to New York City.

But Tekashi’s legal troubles are far from over, including in New York City, where more time on Rikers Island — and therefore more encounters with Trinitarios — are a possibility.

Page Six reported Monday that the Tekashi faces a misdemeanor assault charge, stemming from a May 20 incident in which he tightly grabbed a police lieutenant’s hand during an arrest for a traffic stop. The charge had been downgraded from a felony, but still carries a sentence of up to a year in jail, Page Six said.

On top of that, Tekashi also is under investigation in connection with the June 2 shooting of Chicago rapper Chief Keef at the W Hotel in New York City and faces jail time over a 2015 case in which he pleaded guilty to “the use of a child in a sexual performance.”

The latter case stems from when he performed in a video with a 13-year-old girl — though he has always claimed he never touched the girl and didn’t know she was underage at the time. He avoided prison time and was given probation, on the condition that he complete 300 hours of community service and other requirements. But he may have blown probation because of his recent legal troubles, the Daily News explained.

Tekashi had a court hearing schedule in April, but it was postponed. Meanwhile, he jetted off to Europe to perform as part of his World Domination Tour. He performed in cities in multiple countries and was returning to JFK Airport last Wednesday when he was picked up by New York City police.

Reading this on your iPhone or iPad? Check out our new Apple News app channel here and click the + at the top of the page to save to your Apple News favorites.

During a court hearing the following day, Tekashi acknowledged that he was “not very responsible” by flying off the Europe when he had a pending court case, according to the Daily News.

“In the short time that I’ve been incarcerated, I’ve learned my lesson to be more responsible,” Tekashi said. He added that his “nonworking” mother and young daughter “depend on me and only me.”

After his release, he tried to prove he was “more responsible” over the weekend by posting an Instagram video of himself out in his “community.” In a caption, he claimed he had “started” a soccer league. The video also shows him handing out autographed $20 bills to various people and posing for photos with young kids. The video garnered nearly 1 million likes.

Meanwhile, for his day in court in Houston, Tekashi posted a selfie showing himself dressed in what, for him, apparently passes for formal wear: a white button-down shirt, a haphazardly knotted pink tie and pink-and-white high tops. With his caption, the usually transgressive hip-hop star seems eager to present himself as ready to be a positive, respectful member of society.

“Just went to court,” he wrote. “It was good.”

Tekashi is scheduled to perform for the Last Day of Summer 18 concert at the SAP Center on August 24.

This story has been updated to include Tekashi6ix9ine’s interview with TMZ in which he confirmed he had been threatened by other inmates while in custody.