Advocates for foster children in New York City sued the system Wednesday, accusing state and city agencies of putting children at risk by letting them languish for years without placing them in permanent homes.

The lawsuit filed in federal court in Manhattan claims the more than 11,000 children in the city’s system average far more time there than most places in the country. It said the needless bureaucratic delays subject them to emotional distress and increase the odds of physical or sexual abuse.