Just weeks after releasing his debut album, Finally Rich, Chicago rapper Chief Keef was taken in handcuffs from juvenile court Tuesday after a Cook County judge ordered him held in custody.

Judge Carl Anthony Walker ruled that Chief Keef had violated his probation for a 2011 gun conviction by holding a rifle at a gun range in New York while a video was being shot last summer.

Prosecutors have been seeking to detain the 17-year-old rap sensation for weeks, most recently alleging that he had violated his probation by moving to a north suburb without telling authorities. Police interest in Chief Keef, whose real name is Keith Cozart, grew after he sent a taunting tweet following the slaying of aspiring rapper Lil Jojo in September.

After the judge ordered him taken into custody, Chief Keef emptied his pockets and handed his cellphone to his uncle before a court deputy escorted him from the courtroom in handcuffs, according to his lawyer.

During the approximately two-hour hearing, a gun range employee testified that Chief Keef was holding the rifle during an on-camera interview by Pitchfork Media, an Internet-based music publication.

The judge ruled that by holding the firearm, Chief Keef violated the terms of his 18-month probation sentence for pointing a gun at a Chicago police officer in 2011, according to Andy Conklin, a spokesman for the state's attorney's office.

The rapper is scheduled to be sentenced before Walker on Thursday. Until then, he will be locked up in the juvenile holding facility.