Between March and June 2020, Swiss citizens faced up to three years in prison if they held public or private demonstrations.
The European Court of Human Rights (ECHR) has condemned Switzerland for briefly banning demonstrations during the COVID-19 pandemic.
Judges said the general ban on public protests lacked the necessary "independent and effective judicial control".
From March to June 2020, Swiss citizens faced up to three years in prison if they held public and private demonstrations.
The ban was hastily introduced by the Swiss government in response to the coronavirus pandemic and an increase in infections.
But the ECHR said authorities had violated "freedom of assembly" rights and stated that the "considerably long" ban was a disproportionate measure.
Judges said that Switzerland had not checked whether a ban on protests was compatible with the country's constitution, despite the "very serious" threat to public health.
A ban on protests is a "radical measure which requires solid justification and particularly serious scrutiny by the courts authorised to assess the relevant interests at stake," the court said in its ruling.
Peaceful demonstrations "should not, in principle, be subject to the threat of criminal sanction," it added.
The case in question concerned the Geneva Union Action Community (CGAS) which was forced to cancel an organised demonstration on 1 May 2020.
ECHR judges have ordered the Swiss state to pay €3,000 in legal costs to the association.