According to the lawsuit, the female correction officer ran her hands over Ms. Reynoso’s breasts and genitalia, asked her to squat and violently inserted two fingers into her anus. She said she was menstruating at the time of the visit. “They didn’t care,” Ms. Reynoso said. “They wanted to see if drugs would fall out from my clothes.”

Ms. Reynoso is one of seven women interviewed by The New York Times who have filed lawsuits or notices of claim against the city alleging illegal searches conducted in violation of city policy. A review of these lawsuits and more than two dozen other court cases filed by visitors point to a similar pattern: The visitors said they signed a waiver for a routine pat-down, but instead, they said, they were taken to search rooms or bathrooms for full strip searches, some involving invasive cavity checks. The prevalence of strip searches of visitors in the city’s jails, as detailed in lawsuits, was first reported last year in a joint investigation by The Intercept and WNYC.

The search Ms. Reynoso described is prohibited in city jails. In state and federal prisons, strip searches of visitors are permitted with consent, but not cavity checks. In city jails, however, neither strip searches nor cavity checks of visitors are allowed, Department of Correction officials said.

“There’s no reason for it, no justification for a cavity search, period,” said Martin Horn, who ran the city’s correction department from 2003 to 2009 and is now a professor at John Jay College of Criminal Justice. “I can’t be anymore emphatic than that.”

Yet allegations of inappropriate searches of visitors are common enough to have prompted separate investigations by the Bronx district attorney’s office and the New York City Department of Investigation during the last two years. Neither resulted in criminal charges.