“We are closing intake at the facility in question, placing the provider on corrective action status and tightening our monitoring of all residences throughout the Close to Home system to ensure that young people remain under close staff supervision at all times,” Mr. McKniff said.

The Close to Home program is a juvenile justice initiative in which children are placed by Family Court judges in a residence close to their neighborhood and relatives and, usually, their schools, rather than being sent to distant treatment centers or homes.

According to a criminal complaint, the victim was “barely conscious” in the cafe when the young men started touching her. She told investigators her next memory was being surrounded in a stairwell as she was beaten and sexually abused. After that, the complaint said, she found herself alone and bloodied in the stairwell. Her shirt was inside out. Her camisole and underpants were missing. Her money, credit cards and keys were gone.

The woman stumbled down the street to a 24-hour deli on Canal Street, where clerks comforted her, gave her towels to wipe blood from her face and called the police. As she was taken to a hospital, officials said, the teenagers used her keys to enter her building nearby and ran up the stairs to her apartment but fled when they found someone inside.

Detectives arrested all three suspects at 4:35 a.m. on Tuesday after tracking them to the group home in Park Slope that had been part of the Close to Home program since it began in 2012.

Though Ms. Goun said in court that the suspects were absent without leave from the home when the attack occurred, it was not immediately clear when they left or if their absence was reported.

One of the accused, Mr. Pek, went to the home as an adolescent, said Thanh Luu, the companion of Mr. Pek’s mother who lives with her in Kensington, Brooklyn. Once there, though, the boy was known to skip classes to play video games at Internet bars, Mr. Luu, 61, said.