The Metropolitan Police has been told it cannot rely on its "neither confirm nor deny" policy in its legal battle with women who say they were duped into sexual relationships with two undercover officers.
A judge told the force it must admit or deny the allegations against the men.
The Met argued its policy of not discussing undercover officers meant it could not defend itself.
But the five women involved said that position was simply a cover.
The force may have to confirm whether the officers allegedly involved worked undercover, Mr Justice Bean said.
In the specific cases of two men, known by their aliases Jim Sutton and Bob Robinson, the judge said the policy of not confirming or denying they had been undercover officers could not be relied on.
He gave Met Commissioner Sir Bernard Hogan-Howe 28 days to change the force's defence to either admit or deny that:
- Officers, as part of their undercover work and using false identities, engaged in long-term intimate sexual relationships with those whose activities the Met wished to observe
- This was authorised in or acquiesced to by senior management
- Jim Sutton was such an officer
- Bob Robinson was such an officer
The judge stated that the claims related to the Special Demonstrations Squad (SDS) undercover unit prior to its disbandment in 2008.
"It is not suggested that the use of long-term sexual relationships of this kind as a police tactic is continuing," he added.
"It is also not argued that it would be appropriate now, nor that (if it did occur) it was appropriate then."
Mr Justice Bean said such a tactic would be "a gross abuse".
In cases relating to two other men, the judge did not go as far but he indicated that the Met would have to confirm or deny they had been undercover officers at some stage.
Speaking after the ruling, a lawyer for the women said the decision was a "devastating blow" for the Met.
Solicitor Harriet Wistrich, of Birnberg Peirce and Partners, said: "The police have been on notice of this case for three and a half years and until this judgment they have wilfully refused to engage in any meaningful way with the most serious allegations put to them."
She said the police's behaviour had "greatly aggravated" the women's distress and said her clients wanted "justice and accountability".
A number of allegations have been made since it became known in 2011 that former PC Mark Kennedy had spied on environmental protesters posing as long-haired dropout Mark "Flash" Stone and had at least one sexual relationship with an activist.
It is claimed that five undercover officers engaged in infiltrating environmental campaign groups between the mid-1980s and 2010 had relationships with the women, lasting from seven months to nine years.
The Met has already successfully argued that some of the women's cases will have to be heard behind closed doors at a secret tribunal.
The women's lawyers said police had frequently flouted the policy of not confirming or denying the identities of undercover officers.
That included the case of Mark Kennedy, they said.
Fathered a child
Other officers have confirmed themselves that they worked undercover.
One of them, Bob Lambert - a former undercover officer - fathered a child with a woman who was unaware of his true identity.
He is now being investigated by the Independent Police Complaints Commission over claims the Met spied on the family of the murdered teenager Stephen Lawrence.
In March, Home Secretary Theresa May announced a judge-led public inquiry into undercover policing as a result of that case.
A review found that a Met officer worked within the "Lawrence camp" while a previous inquiry into the death was under way.