NEW YORK — The rapper known as Tekashi 6ix9ine was in federal custody Monday awaiting a Manhattan court appearance on racketeering charges alleging he participated in the July shooting of a bystander in Brooklyn and the gunpoint robbery of his gang's rivals last spring. According to prosecutors, 6ix9ine, 22, could face life in prison if convicted.

The Brooklyn-based rapper, whose legal name is Daniel Hernandez, was among four people arrested on racketeering and firearms charges, authorities said.

An attorney who has previously represented Hernandez did not immediately respond to an email seeking comment Monday.

The authorities also arrested three of Hernandez's former associates, Kifano "Shotti" Jordan, Jensel "Ish" Butler and Faheem "Crippy" Walter. It was unclear whether they had defense attorneys.

Get Breaking News Delivered to Your Inbox Click here to view related media. click to expand

6ix9ine has been one of the most ascendant and controversial names in hip-hop in recent months. His album "Day69: Graduation Day" was among the top records on iTunes following its February release.

He is also known for the multiplatinum hit "Fefe" with Nicki Minaj, which peaked at No. 3 on the pop charts, and "Stoopid," featuring the incarcerated rapper Bobby Shmurda.

But 6ix9ine also has had a series of run-ins with law enforcement and has publicly identified himself as a member of a violent New York gang, 9 Trey Bloods.

In a superseding indictment unsealed Monday in Manhattan federal court, 6ix9ine was charged in connection with what prosecutors described as "Nine Trey Gangsta Bloods," which they said carried out acts of murder, robbery and narcotics trafficking in Manhattan, the Bronx and Brooklyn since at least 2013.

The indictment said each gang member was required to carry out at least two acts of racketeering conspiracy. Those acts could include murder, robbery, extortion and drug distribution, the court papers said.

In April, according to the indictment, 6ix9ine and others participated in a gunpoint robbery of the gang's rivals.

Then in mid-July, the court papers said, the rapper joined three others and agreed to shoot an individual who had shown disrespect to gang members. However, an innocent bystander was shot on a Brooklyn street corner as a result of the agreement, the indictment said.

The 22-year-old recently pleaded guilty to disorderly conduct in Brooklyn Criminal Court in connection with a May traffic stop.

In a 2015 case in New York, 6ix9ine was sentenced to probation for his involvement in a sexually explicit video of a 13-year-old girl.

The video, posted on social media, showed the girl performing a sex act on another man while 6ix9ine "stands behind the child making a thrusting motion with his pelvis and smacking her on her buttocks," according to court documents.