Russia’s so-called gay propaganda law reinforces “stigma and prejudice” and violates the right to freedom of expression, the European Court of Human Rights (ECHR) has ruled.

The law, which bans the promotion of homosexual behaviour to minors, has been in place since 2013.

Gay rights groups have condemned it as discriminatory and warned the law is often used as a tool to target and intimidate the LGBT community in Russia.

Following a major court battle that ended on Tuesday, judges at the court agreed, saying that by adopting the law Russian authorities were encouraging homophobia.

They said the government had “overstepped the margin of appreciation" of Article 10 of the European Convention on Human Rights that guarantees freedom of expression.

In its defence, the Russian government claimed “that regulating public debate on LGBT issues may be justified on the grounds of the protection of morals”.

But the ECHR found in favour of three gay activists who claimed the law violated the rights to freedom of expression and prohibition of discrimination under the European Convention on Human Rights.

The court rejected the government’s claim that regulating public debate on LGBT issues had been justified by the need to protect morals, and said they had failed to demonstrate how freedom of expression would devalue “traditional families”, as Russian officials had claimed.

The judges said there was a “clear European consensus about the recognition of individuals’ right to openly identify themselves as gay, lesbian or any other sexual minority, and to promote their own rights and freedoms”.

The top 15 worst countries to be gay in Europe Show all 15 1 /15 The top 15 worst countries to be gay in Europe The top 15 worst countries to be gay in Europe 15. Italy Getty Images The top 15 worst countries to be gay in Europe 14. Macedonia Processed by: Helicon Filter; The top 15 worst countries to be gay in Europe 13. Poland Getty Images The top 15 worst countries to be gay in Europe 12. Liechtenstein The top 15 worst countries to be gay in Europe 11. Lithuania The top 15 worst countries to be gay in Europe 10. Latvia This content is subject to copyright. The top 15 worst countries to be gay in Europe 9. San Marino The top 15 worst countries to be gay in Europe 8. Moldova The top 15 worst countries to be gay in Europe 7. Belarus Getty Images The top 15 worst countries to be gay in Europe 6. Ukraine Getty Images The top 15 worst countries to be gay in Europe 5. Monaco The top 15 worst countries to be gay in Europe 4. Turkey Getty Images The top 15 worst countries to be gay in Europe 3. Armenia The top 15 worst countries to be gay in Europe 2. Russia Getty Images The top 15 worst countries to be gay in Europe 1. Azerbaijan Norway's Mette B. Bjerknaes competes during the Powerboat race on July 6, 2013 in Baku. Baku hosts the second race F2 World Championship 2013. The 2 mile course is designed just in front of the Baku Boulevard facing the Caspian Sea. AFP PHOTO / TOFIK BABAYEV (Photo credit should read TOFIK BABAYEV/AFP/Getty Images) Getty/AFP

Commenting on the claim that minors could be “converted” to homosexuality, the court found that the Russian government had been “unable to provide any explanation of the mechanism by which a minor could be enticed into ‘[a] homosexual lifestyle’, let alone science-based evidence that one’s sexual orientation or identity was susceptible to change under external influence”.

One of the claimants, Nikolai Alexeyev, a leading gay rights activist, described the ruling as “an enormous court victory for LGBT people in Russia”.

Along with two others involved in the case, Nikolai Bayev and Alexei Kiselyov, Mr Alexeyev had staged demonstrations to defend gay rights – for which he and others had been fined – and unsuccessfully applied for permission to hold gay pride parades in Russia.

Police detain Nikolai Alexeyev during a protest outside the Sochi 2014 Winter Olympic Games (AP)

The court said: “In staging their demonstrations, the applicants had not sought to interact with minors, nor intrude into their private space.

“Nothing on their banners had been inaccurate, sexually explicit or aggressive; nor could their messages have been interpreted as an invitation for tuition on gender issues.”

The adoption of the views expressed by the gay activists could “only be conducive to social cohesion”, the judges added.

“By adopting such laws the court found that the authorities had reinforced stigma and prejudice and encouraged homophobia, which was incompatible with the values – of equality, pluralism and tolerance – of a democratic society.”

The Strasbourg-based court oversees the application of the European Convention on Human Rights to the 47 members of the Council of Europe, of which Russia is a member.

However, it is unclear what impact the ruling will have. Although the court’s rulings are binding, Russia passed a law in 2015 saying that its constitution superseded ECHR rulings.

In a recent case, Russia’s constitutional court said an ECHR ruling ordering a compensation payment to shareholders of a defunct oil company could not be enforced.

A Kremlin spokesman said the government would “review” the court’s latest ruling.

Russia’s justice ministry also expressed its “disagreement with the conclusions of the European court” in a statement.

Homosexuality was decriminalised in Russia in 1993, but anti-gay sentiment remains strong, including in the Russian federal republic of Chechnya, which has been the subject of international condemnation following the systemic abuse of gay men.

Human Rights Watch report confirms 'gruesome' extent of gay persecution in Chechnya

Vladimir Putin claimed in a recent interview that the “gay propaganda” law was intended to “provide children with the opportunity to grow up without impacting their consciousness.

“When they grow up, they may take any decision on their future, including private and sexual ones.”

Denis Krivosheev, Amnesty International’s Europe and Central Asia research deputy director, backed the ECHR ruling, saying the legislation “has always been nothing short of homophobic”.

He told The Independent: “The law is blatantly discriminatory and violates the right to freedom of expression, and its introduction has undoubtedly contributed to homophobia and violence targeting LGBTI people in Russia.

“We strongly welcome today’s ruling, not least given the renewed urgency over investigating the reports of a terrifying campaign of mass abduction and torture of gay men in Chechnya.