The Ministry of Justice (MoJ) failed to prevent systemic breaches of inmates human rights when they were unlawfully strip searched at a privately-run jail.
The searches involved four inmates at HMP Peterborough in 2017, including one inmate who was menstruating.
Sodexo runs the prison and admitted it had breached MoJ privacy rules through its failure to properly train staff.
The MoJ should have had effective safeguards in place against privacy breaches, the High Court has ruled.
The inmates involved in the strip searches in July and September 2017 were three women and a transgender prisoner, who was transitioning from female to male.
Justice Julian Knowles said one of the claimants had been menstruating at the time and the strip search in her case involved the removal of her underwear and the removal and disposal of her sanitary towel, which he said, "must plainly have been humiliating and embarrassing for the woman concerned".
The judge said a significant proportion of the prisoners had experienced sexual, physical or psychological abuse in the past, "giving rise to particular concerns about their vulnerability".
He concluded the MoJ's monitoring and supervision of Sodexo's operation at HMP Peterborough had failed.
Sodexo admitted all five searches were unlawful because its officers conducted a "level two" strip search without first carrying out a less intrusive "level one" search, which meant women could keep their underwear on.
Sodexo said it had since conducted a review of its strip searching procedures and had introduced a number of new safeguarding measures at HMP Peterborough.
Samuel Genen, a solicitor with Steel and Shamash acting for the claimants, said: "This judgment highlights the stark failures of both defendants to protect the most basic rights of vulnerable women in their care."
He said the judgment had enormous implications for companies that continuously failed to meet the minimum standards for basic dignity of people in their care, such as private care homes, immigration detention centres and general contracting out of public services.
A Ministry of Justice spokesman said: "We have a robust national policy on searching and we expect our providers to adhere to it."
He added the department had reiterated its search policy to contractors and "welcome their improvements thus far".