The girl was picked up for prostitution, close to dawn, on Franklin Square in the heart of downtown Washington. She said she was 17, but authorities quickly learned that she was only 12 and a runaway from New York City.

Encountering a girl so young selling herself on the street took officials by surprise. The run-in with police on Nov. 9, a Saturday, set the girl on a bureaucratic odyssey, as city agencies and the court system struggled to figure out how to handle an unusual case that straddled the city's child protection and juvenile justice systems.

Over the course of 11 days, the girl would be the subject of discussions among authorities and twice pass through a gantlet of paperwork and interviews. Along the way, she was sexually assaulted by two older girls at the District's juvenile detention facility.

The girl was sent back to New York on Nov. 20. For the past two weeks, District officials have been trying to reconstruct what happened while she was in their care. Carolyn N. Graham, the deputy mayor overseeing the review, said she was disturbed by a "breakdown" in the city's web of social services. She added that the circumstances of the girl's case were highly disturbing, even in a city that has experienced a recent surge in prostitution arrests.

"What are we becoming as a society?" Graham asked. "Five o'clock in the morning. A 12-year-old. My mind can't even wrap around that."

Franklin Square, a park filled with office workers, tourists and panhandlers by day, is a major site of the sex trade at night. Police have reported a sizable increase in prostitution arrests this year, many involving minors who are brought to Washington in loosely organized rings.

An undercover officer in the city's anti-prostitution unit said that minors who are picked up often give false information to the police, making it nearly impossible to track down their records.

"It is a problem when they lie," the officer said, adding that "we have no system in place" to ascertain the girls' true history. "That's a major loophole."

In the 12-year-old's case, the city learned her true name and age only after police took her to the Child and Family Services Agency for an interview. The girl told a social worker that she had arrived in Washington two days earlier.

Graham said the police also picked up a man and two women accompanying the girl. She said the man was under criminal investigation, but police would not discuss the case.

According to officials, police officers contacted the girl's grandmother in Brooklyn, who said that she had filed a missing-person report. The Washington police charged the girl as a fugitive from her guardian and took her to the juvenile processing unit at D.C. Superior Court.

She was then sent to the Oak Hill Youth Center in Laurel for a short-term stay pending an initial court hearing, which occurred on Monday. On Sunday evening, according to officials, the girl was sexually assaulted by two other residents in Unit 6, the girls' building at Oak Hill.

Debra A. Daniels, a spokeswoman for the Department of Human Services, said its Youth Services Administration, which operates Oak Hill, has retrained staff in Unit 6 and ordered guards to make inspections every 15 minutes and to patrol the hallways of sleeping areas at night.

"Policies and procedures regarding room checks may not have been appropriately followed or documented on the night of the incident," Daniels said, adding that an investigation was underway.

Under court order and city policies, runaways and children detained awaiting trial are not supposed to be housed with juvenile offenders committed to the city's custody. Unit 6, the only space designated for girls at Oak Hill, does not have individual sleeping quarters.

The city has broken ground on a new facility in Northeast Washington that will house detained children and runaways. Oak Hill would exclusively house convicted juvenile offenders.

The girl's journey through the government maze continued at a court hearing Nov. 11, when city lawyers and court officials agreed to drop the runaway charge and referred her to Child and Family Services for a neglect investigation.

What happened next is unclear. Child protection officials took the girl to Children's Hospital for a medical screening, but later that day police officers arrived with a warrant issued in Family Court in Brooklyn to arrest her as a runaway.

"We were going to place her, when all of a sudden this legal document appeared, and she was taken away again," said Mindy L. Good, a spokeswoman for the Child and Family Services Agency.

For a second time, the girl was taken to Superior Court and then to Oak Hill. It is not known what happened next, but child protection workers retrieved the girl from Oak Hill and filed a neglect petition in court Nov. 12. The girl stayed with a foster family until she was returned to New York eight days later.

"I'm concerned about the events on the 11th," Graham said. "There's just so many unanswered questions."

Good said the agency's jurisdiction was initially limited because the girl was a runaway and not clearly an abuse victim, and later because of the existence of an arrest warrant. She said the agency had clear authority over the girl only after she disclosed the sexual assault at Oak Hill and alleged that she had been abused at home.

Laws in the District and most states permit the detention of runaways and children deemed "ungovernable" as "persons in need of supervision." The New York arrest warrant was filed under such a law.

Authorities are often poorly equipped to deal with runaways, who frequently are involved with crimes or are victims of abuse or neglect, said Lee E. Teitelbaum, the dean of Cornell Law School and a family law expert. "There's certainly a risk that these children will fall into the cracks," he said.

Staff writer Clarence Williams contributed to this report.