The Ministry of Justice (MoJ) failed to prevent "systemic breaches" of the human rights of inmates who were unlawfully strip searched at a privately-run prison, the High Court has ruled.
Four inmates at HMP Peterborough claimed the MoJ was required to ensure adequate and effective safeguards against breaches of their right to privacy were in place at the jail.
Sodexo, which runs the prison, admitted it was responsible for a "systemic failure" to follow MoJ rules on strip searches because it failed to properly train its staff.
The four claimants - three women and a transgender prisoner, who is transitioning from female to male - also sought a declaration from the High Court that the MoJ had failed in its responsibility to ensure Sodexo was not violating their human rights.
Giving his judgement in London, Mr Justice Julian Knowles found there were "numerous serious, systemic and widespread failures at HMP Peterborough ... which led to a number of strip searches being carried unlawfully".
The judge ruled: "The measures put in place by the Secretary of State (for Justice) to ensure that Sodexo had procedures in place to train its staff properly so that there were not systemic or widespread mistakes - which is an aspect of his duty to monitor and supervise - therefore failed.
"Those measures cannot therefore be described as having been effective, if they had been effective then staff would have been properly trained and the breaches would not have occurred in a way properly described a systemic."
The claimants' case that there had also been a breach of their right to freedom from inhuman or degrading treatment was dismissed.
Their legal action followed five unlawful strip searches carried out in July and September 2017.
All four inmates were unlawfully strip searched on the first occasion but only the transgender prisoner, known as LW, was strip searched on the second occasion.
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, as required by prison rules.
A level one search involves the removal of the woman's clothing apart from her underwear, whereas a level two search involves the removal of all of the woman's clothing including her underwear.
Mr Justice Julian Knowles said in his judgement: "The purpose of this policy is to ensure that the infringement of human dignity that is inherent in a level two search only occurs where absolutely necessary."
He added "the need for that restraint is amply demonstrated here, where one of the claimants was menstruating, and the level two search in her case involving the removal of her underwear and also the removal and disposal of her sanitary towel", which he said "must plainly have been humiliating and embarrassing for the woman concerned".
The judge also found officers "defaulted to the most intrusive form of search", which he said "exacerbates the seriousness of the systemic failures and what I have concluded was the Secretary of State's failure to implement effective systems for the monitoring and supervision of Sodexo's operation of HMP Peterborough".
He noted "a significant proportion of (female and transgender prisoners) have previously experienced sexual, physical or psychological abuse, giving rise to particular concerns about their vulnerability".
That vulnerability, the judge found, meant there was "a particular need for care by Sodexo to ensure that staff were adequately trained in this field and, on the part of the Secretary of State, a heightened need to ensure that the overall framework for which he was responsible operated so as to ensure that Sodexo was training its staff properly".
In its evidence to the court, Sodexo said it had conducted a review of its strip searching procedures at HMP Peterborough and introduced a number of new safeguarding measures, which had resulted in a "significant reduction in the number of full (strip) searches" at the prison.