Hungary's parliament has passed a law banning the "promotion" of homosexuality to minors in what critics have criticised as a crackdown on LGBTQ rights.

The law is the latest in a series of measures under right-wing Prime Minister Viktor Orban's government it says are aimed at fighting paedophilia and protecting children.

But critics claim the law - which effectively bans educational programmes and publicity of LGBTQ groups - would "severely restrict" freedom of expression and children's rights.

More than 5,000 people rallied outside parliament on Monday against the legislation, which LGBTQ groups have compared to similar legislation in Russia.

The law passed with 157 votes in favour and one vote against in the parliament controlled by Mr Orban's Fidesz party.

The opposition boycotted the vote except for politicians from the nationalist Jobbik party who supported the law.

"In order to ensure... the protection of children's rights, pornography and content that depicts sexuality for its own purposes or that promotes deviation from gender identity, gender reassignment and homosexuality shall not be made available to persons under the age of 18," the legal text reads.

Sexual education classes "should not be aimed at promoting gender segregation, gender reassignment or homosexuality", it adds.

It was not clear what punishments could be meted out for those seen as breaking the new law.

'Chilling effect'

Speaking to Reuters, the European Commissioner for Equality Helena Dalli said that the EU could impose funding restrictions on Hungary over the legislation.

Speaking shortly before Hungary's parliament approved the ban, Ms Dalli said Brussels was prepared to take measures similar to those imposed on Polish regions that had declared themselves "LGBT-free".

"The message is that if you don't uphold the values of democracy or equality of the European Union, you are not entitled to take money for your project," she said in an interview by video call.

Asked if the EU was likely to impose similar sanctions on Hungary if the ruling party's bill became law, Ms Dalli said: "Yes, of course. Definitely."

The law could mean that movies that some see as promoting homosexuality, such as Bridget Jones's Diary, Harry Potter or Billy Elliot, can only be shown at night with an 18-plus classification, broadcaster RTL Klub Hungary said.

Attila Kelemen was among thousands who protested against the law on Monday, saying it was getting "more and more uncomfortable" to live in Hungary "not only for gays, but practically also for everybody".

"To mix up homosexuality with sexual crimes is disgusting," the school psychologist, 23, told AFP.

Amnesty International sees in the law "the government's attempt to spread hatred", saying politicians "are risking people's lives for their cruel political campaign".

"The text of the law is very ambiguous and that is on purpose. We do not know the full consequences yet," Zsolt Szekeres of rights group Hungarian Helsinki Committee told AFP.

"Even if it does not mean that a Gay Pride would be banned, it has a chilling effect on organisers ... because they would be scared of the consequences and it gives an excuse to the police to initiate proceedings."

Advertising by companies such as Coca-Cola, which campaigned for gay acceptance in Hungary in 2019, could be banned, as could books dramatising homosexuality.

In recent years, Mr Orban, who has ruled Hungary since 2010, has enacted a socially conservative policy agenda, shaping the EU member into what he calls a bastion against liberal ideologies.

Last December, parliament adopted a package of measures enshrining what is seen as the traditional family, effectively banning adoption by same-sex couples.

In May 2020, a ban on legally changing one's gender came into force, with rights groups warning this would expose transgender Hungarians to discrimination.

In 2018, a government decree effectively banned universities from teaching courses on gender studies.