“Whenever you see this kind of scope, whenever you see this kind of pervasive culture that was allowed to exist, you have to wonder how far up the chain this goes,” Mr. Shapiro said. “I want this community to know we are continuing to work to answer that question.”

Several female inmates told the grand jury that the guards offered them cigarettes, commissary goods and additional time on the phone in exchange for sex, according to court documents. While some guards took the inmates into closets to have sex, others showed little fear of getting caught and propositioned inmates in their cells.

At least one guard, who worked at the Lackawanna County Prison from 1999 to 2013, devised a system with other officers to alert one another if they were about to be caught, officials said. If the sexual acts inside the jail cell needed to be cut short, the court documents said, guards inside a jail monitoring room would remotely “click” the cell lock to alert the guard.

Some of the allegations are from more than a decade ago, a period during which several other Lackawanna correction officers were accused of assault. A former guard pleaded guilty in 2015 to sexually assaulting five inmates from 2002 to 2011. Several female inmates filed a lawsuit in 2016 claiming that they had been sexually abused by guards.

In the lawsuit, one of the inmates claimed that she reported allegations of sexual abuse to an assistant warden at the prison, who “sent officers into her cell to destroy her complaints.” Some guards named in the lawsuit were among those charged on Thursday.

A county spokesman told The Associated Press that many of the allegations “occurred many, many years ago,” and that the prison was safe.