The European Court of Human Rights ruled that a Russian law banning the promotion of homosexuality to minors breached European treaty rules, angering Moscow, which said on Tuesday it would appeal what it called an unjust decision.
Under the legislation, any event or act regarded by the authorities as an attempt to promote homosexuality to minors is illegal and punishable by a fine. The law has been used to stop gay pride marches and to detain gay rights activists.
The Strasbourg court ruled the law violated people's right to freedom of expression and discriminated against gay people.
"The Court found in particular that, although the laws in question aimed primarily at protecting minors, the limits of those laws had not been clearly defined and their application had been arbitrary," the court said in a statement.
"Indeed, by adopting such laws, the authorities had reinforced stigma and prejudice and encouraged homophobia, which was incompatible with the values of a democratic society."
The ruling is likely to strain already poor relations between Russia and the Strasbourg-based court, which last year said Moscow had violated the European Convention on Human Rights in all but six of its 228 judgements in Russian cases.
It is also likely to be seen by pro-Kremlin politicians and Orthodox Church leaders as an attempt to foist what they call unacceptably liberal "European values" on a country whose leaders constantly emphasise the need to stick to "traditional values."
Homosexuality in Russia, where the influence of the socially conservative Orthodox Church has grown in recent years, was a criminal offence until 1993 and classed as a mental illness until 1999.
The Russian Justice Ministry said in a statement it did not agree with the court and pledged to appeal the ruling within three months. It said the law was solely designed "to defend morality and children's health" and did not amount to a ban or public condemnation of homosexuality.
Human rights defenders say the contested law has been broadly applied to intimidate Russia's LGBT community, however.
Tuesday's case was originally brought by three Russian gay rights activists who were fined for holding banners designed to encourage acceptance of homosexuality, between 2009 and 2012. The court ordered Russia to pay them thousands of euros in damages.
Nikolai Alekseyev, one of the activists, said in a statement the ruling was "a historic victory" that he pledged to use to urge the Russian authorities to scrap the law.
"The way this law has been applied shows that it is not aimed at protecting minors, but at removing LGBT people, an enormous social group, from the public space, and at stripping them of their right to speak out or fight for their rights," he said.
Want to enjoy 'Zen' reading - with no ads and just the article? Subscribe todaySubscribe now