NEW YORK (AP) — Rapper Tekashi 6ix9ine tried unsuccessfully Tuesday to persuade a federal judge not to send him to jail, calling him "bro" and insisting he never meant to violate the terms of his probation from a felony conviction.

Judge Paul A. Engelmayer in Manhattan ordered him detained for at least two weeks, citing alleged misconduct such as failing drug tests and declining to get required permission to travel — acts that he said would reflect a lack of respect for the law.

The judge also noted that the performer left the Dominican Republic this year, violating a court order to remain there after he was arrested in January on domestic violence charges and detained in October 2023 after he was accused of assaulting a local music producer. His lawyers say he's being treated unfairly there in a corrupt judicial system.

In 2019, Engelmayer sentenced him to two years in prison in a racketeering case. The musician, whose real name is Daniel Hernandez, pleaded guilty in 2019 to charges accusing him of joining and directing violence by the gang known as Nine Trey Gangsta Bloods.

Tekashi 6ix9ine was supposed to appear in court on Tuesday morning. When he didn't, Engelmayer signed an arrest warrant. When the rapper showed up later that morning, he was arrested and accused of violating his probation repeatedly through what a prosecutor described as a “pattern of noncompliance.”

Engelmayer, who had freed Tekashi 6ix9ine months early in April 2020 by granting a compassionate release request because of dangers the coronavirus posed for him, was stern as the rapper sat before him.

He seemed to soften somewhat after Tekashi 6ix9ine insisted on addressing him directly.

The rapper apologized for coming to court late.

“I'm not a bad person,” he said, noting that he finished four-and-a-half years of a five-year term of supervised release but ran into problems after his supervision was switched in July from court officers in New York to court officers in the Southern District of Florida, where he lives now.

He disputed a prosecutor's claims that he didn't request permission as required to go to Las Vegas in early September for a show in front of 20,000 people, and he said he skipped two drug-testing appointments because he thought they weren't required after an earlier positive test for marijuana use proved erroneous.

“I feel like I did nothing wrong,” he said, though quickly he added that he knew he'd done a few things that were “technically” wrong.

Otherwise, he said, he'd been “squeaky clean.”

He also said his life was difficult and the “past four years has been bad, bro.”

He added: “Freedom is everything for me.”

Later, Tekashi 6ix9ine addressed the judge more typically, saying his failure to show up to a couple of drug tests was “just a misunderstanding, your honor.” He insisted he's never done drugs and that a drug test that found methamphetameme resulted from prescription drugs that contained traces of the substance.

At another point, he told Engelmayer: “I'm not a piece of,” before pausing, apparently to choose the right words, before saying: “I'm not a bad person.”

The judge conceded that there might be justification for some of his behavior, but he said he sensed the rapper had been “cutting corners.”

After the hearing, the rapper's lawyer, Lance Lazzaro, said in an email that his client was charged with three “technical violations” of his supervised release and that he was “confident that each specification will be dismissed.”

The musician's next hearing is scheduled for Nov. 12.