The European Union's top court has ruled that Hungarian anti-LGBTQ laws violate EU rules and infringe its values of equality and minority rights.

The laws were brought in by Viktor Orbán's government in 2021 and banned so-called promotion of homosexuality or gender change to under-18s, arguing it violated child protection laws.

The European Court of Justice ruled that the Orbán reforms breached EU rules on a number of levels, and significantly that it also broke the founding values of Article 2 of the EU Treaty - an unprecedented finding.

The ruling comes nine days after Hungarians voted to end Orbán's 16-year era of continuous rule.

The ECJ ruled that the Hungarian law interfered with rights such as a ban on discrimination based on sex and sexual orientation, respect for private and family life and freedom of expression and information.

The law also stigmatised and marginalised people who were transgender or not heterosexual and associated them with people convicted of paedophilia, the court found.

The Hungarian law was contrary to the very identity of the Union as a common legal order in a society in which pluralism prevails, it ruled.

John Morijn, professor of law and politics in international relations at the University of Groningen in the Netherlands, said the Court's ruling was historic in its symbolism, in that it meant the rights of a group in society could not be negotiated away.

You cannot equate what is totally natural - that 10% of the population loves the same sex - with egregious crime, he told the BBC.

Orbán's Fidesz party was able to push through the legislation with the help of a supermajority - with control of two-thirds of parliament.

Last year, it passed a further amendment that enabled a ban on public events involving the LGBTQ community such as Budapest's popular Pride march, which went ahead despite the ban, prompting prosecutors to file charges against Mayor Gergely Karácsony.

The European Commission said the anti-LGBTQ law would be one of the issues it would be taking up with the new government once it was in place.

It's up to the... Hungarian government to abide by the ruling and once that is done the issue is solved, said spokeswoman Paula Pinho.

The man whose Tisza party defeated Orbán on 12 April, Péter Magyar, has not said much about the laws related to Hungary's LGBTQ community.

However, in his victory speech, he spelt out his vision for Hungary as a country where no-one is stigmatised for thinking differently than the majority, or loving differently than the majority.

Magyar has promised to adopt a far more pro-European approach to Hungary's relations with the EU and it will be the responsibility of his government to reverse the legislation. His Tisza party has a two-thirds majority of 141 seats in the 199-seat National Assembly.

He has also promised to unlock billions of euros in EU funding for Hungary, part of which was blocked because of issues surrounding the rule of law.

Katja Štefanec Gärtner of LGBTQ rights group Ilga-Europe said there was now no excuse for the European Commission not to require Hungary to scrap its law fast.

If Péter Magyar truly aims to be pro-EU, he must place this at the top of his agenda for his first 100 days in office, Štefanec Gärtner said.

Prof Morijn told the BBC the ECJ ruling could have wider legal implications regarding other EU member states, as it meant that the Commission could in future go to a member state over the rule of law with a similar warning.

You are basically violating EU law in such a fundamental way we are not only holding you to account for violating the letter of the law but also violating the spirit of that law, laid down in Article 2, which lists all the values of pluralism, equality and rule of law, Morijn said.