A police ban on Extinction Rebellion protests in London last month was unlawful, High Court judges have ruled.
The Metropolitan Police imposed the ban, which prevented two or more people from the group taking part in protests, under the Public Order Act.
But judges have ruled that police had no power to do this because the law did not cover "separate assemblies".
Activists say the police could now face claims for false imprisonment from "potentially hundreds" of protesters.
The Met said it would "carefully consider" the ruling.
The protests cost £24m to police and led to 1,828 arrests, with 165 people charged with offences, the Met says.
During the court hearing, the force had argued that the ban was the only way to tackle widespread disruption.
Announcing their judgement, however, Lord Justice Dingemans and Mr Justice Chamberlain ruled in favour of Extinction Rebellion.
Lord Justice Dingemans said: "Separate gatherings, separated both in time and by many miles, even if co-ordinated under the umbrella of one body, are not a public assembly within the meaning of... the Act.
"The XR [Extinction Rebellion] autumn uprising intended to be held from October 14 to 19 was not therefore a public assembly... therefore the decision to impose the condition was unlawful because there was no power to impose it under... the Act."
The judges noted that there are powers within that act which may be used lawfully to "control future protests which are deliberately designed to 'take police resources to breaking point"'.
During 10 days of climate change protests last month, activists shut down areas around Parliament and the Bank of England, and targeted London City Airport.
Police had previously warned protesters to keep demonstrations in Trafalgar Square, or risk arrest - before issuing a city-wide ban on 14 October, under Section 14 of the Public Order Act.
The court was told that the ban was issued on the same day as a message posted online by London activists.
It told protesters to adopt the "be water" tactics used by demonstrators in Hong Kong.
"Be water, crowds split up into fast moving groups and pairs, that network via phones," it said.
"You gather at particular spots in large numbers, until the police response building then you move to a new disruptive site."
The ban was lifted four days later, with officers saying that it was no longer necessary because demonstrations had ended.
BBC home affairs correspondent Daniel Sandford
This was a radical tactic adopted by the Metropolitan Police on 14 October - banning all future Extinction Rebellion protests across London for several days.
But it has backfired. No police force likes to have their actions described as "unlawful".
Today's High Court ruling takes away from officers the ability to impose a city-wide ban of future protests, which means demonstrators wanting to be "like water" - where they split into fast-moving groups - will be difficult to control if they are trying to disrupt a whole city.
So police will have to deal with what is in front of them.
If a specific protest in a specific place gets out of hand they will be able to close it down, but it will have to be a decision made by an officer on the spot, and not by someone sitting in a police station worrying about what protests may happen the next day.
Responding to Wednesday's ruling, Extinction Rebellion UK tweeted "we won't be silenced".
Green Party peer Jenny Jones - who was among those to bring the legal challenge - described the ruling as "historic" and criticised ministers for speaking out in favour of the ban.
Met Assistant Commissioner Nick Ephgrave said the decision to impose the ban had been "reasonable and proportionate" and "was not taken lightly".
He added that the police "would not and cannot ban protest" and that the ruling was made specifically on whether officers could arrest demonstrators for assembling in central London.
"There is no criticism from me of the decision to impose the condition, which was made with good intent and based upon the circumstances confronting the command team at the time," he said.
"It did in fact result in the reduction of the disruption. Nevertheless, this case highlights that policing demonstrations like these, within the existing legal framework, can be challenging."
What does Extinction Rebellion want?
Extinction Rebellion's legal victory follows two weeks of protests in the UK last month.
The group (XR for short) wants governments to declare a "climate and ecological emergency" and take immediate action to address climate change.
It describes itself as an international "non-violent civil disobedience activist movement".
Launched in 2018, organisers say it has groups willing to take action in dozens of countries.
It uses an hourglass inside a circle as its logo, to represent time running out for many species.