BRUSSELS — A culture war between Hungary and the European Union escalated Wednesday after a top official from the bloc said she would use all her powers to thwart a new Hungarian law that critics say targets the L.G.B.T. community.
The law, which would ban the depiction or promotion of homosexuality to those under 18 years of age, an addition to legislation targeting pedophiles, has been approved in Hungary’s Parliament but still must be endorsed by the country’s president.
The legislation was sharply criticized on Wednesday by the president of the European Commission, Ursula von der Leyen.
“This Hungarian bill is a shame,” Ms. von der Leyen said in a statement. “This bill clearly discriminates against people based on their sexual orientation. It goes against the fundamental values of the European Union: human dignity, equality and respect for human rights.”
Prime Minister Viktor Orban of Hungary, who has defended the law, will come under pressure to withdraw it during a European Union meeting of heads of state and government on Thursday and Friday. It is the latest confrontation between the European Union and Mr. Orban, who styles himself as the champion of an “illiberal democracy” that can sometimes run counter to the democratic values of the bloc.
Ms. von der Leyen described the European Union as a place “where you are free to be who you are and love whomever you want,” adding: “I will use all the powers of the commission to ensure that the rights of all E.U. citizens are guaranteed. Whoever they are and wherever they live within the European Union.”
European ambassadors excoriated the bill in pre-summit background briefings on Wednesday, saying it violated European Union treaties and crossed red lines. They expressed the hope that Mr. Orban would pull back from challenging Brussels in this way, as he has sometimes done in the past.
There is no quick remedy if Hungary goes ahead with the law, the diplomats said. But the commission, which is officially the guardian of compliance with the treaties, could bring a case against Hungary in the European Court of Justice for breaching them. The court, if it chose, could act relatively quickly, and Hungary has in the past respected its rulings.
The proposed law prohibits sharing content on homosexuality or gender confirmation surgery to people under 18 in school sex education programs, films or advertisements. The government says it is intended to protect children, but critics of the law say it links homosexuality with pedophilia.
In a response later Wednesday, the Hungarian government said in a statement that Ms. von der Leyen’s comments were “based on false allegations” and reflected “a biased political opinion without a previously conducted, impartial inquiry.”
The statement added: “The recently adopted Hungarian bill protects the rights of children, guarantees the rights of parents and does not apply to the sexual orientation rights of those over 18 years of age, so it does not contain any discriminatory elements.’’
Mr. Orban has portrayed himself as a defender of traditional Christian and national values, which he says are being undermined by new concepts of sexual identity and behavior. His government is also under pressure over its performance, particularly its response to the coronavirus, so Mr. Orban has been using such cultural issues to fire up his conservative base ahead of elections next year.
A European Union official said that Ms. von der Leyen wanted to send a political message to the Hungarians and that she planned to speak to Mr. Orban about the issue privately.
On Tuesday, as European ministers were meeting in Luxembourg, Foreign Minister Peter Szijjarto of Hungary said that the law was only aimed at pedophiles and did not restrict the sexual freedom of adults. “The law protects the children in a way that it makes it an exclusive right of the parents to educate their kids regarding sexual orientation until the age of 18,” he said. “This law doesn’t say anything about sexual orientation of adults.”
Belgium, Luxembourg, and the Netherlands wrote a joint declaration condemning the law as a violation of the right to freedom of expression and a “flagrant form of discrimination based on sexual orientation.”
Ireland’s minister for Europe, Thomas Byrne, said: “I am very concerned — it is wrong what has happened there.” Mr. Byrne called it “a very, very dangerous moment for Hungary and for the E.U. as well.”
Germany’s European affairs minister, Michael Roth, spoke of concerns that both Hungary and Poland were violating the rule of law by restricting the freedoms of courts, academics and the news media, as well as the rights of women, migrants and minorities.
“The European Union is not primarily a single market or a currency union,” Mr. Roth said. “We are a community of values, these values bind us all,” he said. “There should be absolutely no doubt that minorities, sexual minorities too, must be treated respectfully.”
In an effort at a public response, the city of Munich vowed to illuminate its stadium in the rainbow colors of the Pride flag when Germany meets Hungary in the European soccer championship Wednesday night, but was refused permission to do so by the game’s governing body, UEFA, which said the game must be kept free of politics.
Mr. Orban, who is a passionate soccer fan, has decided to cancel a visit to Munich, the capital of the German state of Bavaria, for the game and instead travel directly to Brussels, according to the German press agency, DPA. The Hungarian government said that it never commented on Mr. Orban’s “private program.”
The prime minister of Bavaria, Markus Söder, said that Germans had to “stand up against exclusion and discrimination,” while Munich’s gay community said rainbow flags would be handed out to fans outside the stadium. A number of other stadiums in Germany planned to light up in rainbow colors.
Monika Pronzcuk contributed reporting.