But Rachel Glantz, a lawyer from the office of New York City’s Corporation Counsel, said the teenager had acted out during his detention, approaching a staff member “in an aggressive manner.” Staff members were later forced to escort him to his room, Ms. Glantz said.

Ms. Kaplan sought to play down the encounter, saying that the teenager had said something inappropriate when the staff member tried to take away a video game he was playing.

The judge, however, ordered the 13-year-old sent back to detention until March 16, when his trial is scheduled to start. The teenager’s expression sank. His legal guardians, Shaquoya Carr and Roosevelt Davis, were visibly upset as they left the courtroom.

“We are very mindful of the fact of your detention,” Judge Goldstein said, addressing the teenager. “And we are trying to get this case heard just as soon as we actually can.”

It remained unclear whether the other two teenagers that the 13-year-old has said participated in the attack on Ms. Majors will be charged. Under New York law, they could not be convicted solely on the basis of his testimony.

Detectives are hoping forensic and DNA evidence will help solve the case. One of the other two teenagers provided a forensic sample to the police after a different Manhattan judge signed a search warrant, the police said.

Image Tessa Majors, a first-year Barnard College student, was fatally stabbed on Dec. 11.

The killing of Ms. Majors in Morningside Park, not far from the Barnard campus, on Dec. 11 evoked a more dangerous era of 30 years ago, when the park was known for muggings and violent attacks, especially after dark.