Facing an election on Sunday, Viktor Orban plays neutral peacemaker while campaigning against the “gender insanity” that he says is creeping in from the West.DEBRECEN, Hungary — The towering memorial, erected on the battlefield where the Russian imperial army routed Hungarian troops, mourns Russia’s 1849 victory over “brave homeland defenders.” It is a reminder of how, for centuries, the Hungarian psyche has been shaped and scarred by the specter of Russian domination.“There has been a constant fear of Russia,” said Gyorgy Miru, a history professor in Debrecen, a Hungarian city near the border with Ukraine where the battle took place.Under Prime Minister Viktor Orban, however, this fear has turned into a trusting embrace. Mr. Orban, a political bruiser who revels in defying what he scorns as liberal conventions, has for years looked to Russia as a reliable source of energy and its president, Vladimir V. Putin, as a beacon of no-nonsense nationalism and muscular leadership, emulating in a milder form the Kremlin’s stranglehold on media and its one-party system.Amid the agonies inflicted on neighboring Ukraine over the past five weeks by Moscow, Mr. Orban’s stance has left many in Hungary and beyond dismayed and angry that a nation with such a long and painful experience of Russian aggression could fall so far out of step with the rest of Europe.Facing an election on Sunday against an unusually united opposition, Mr. Orban has cast himself as a neutral peacemaker who does not want to fan the war by sending weapons to Ukraine or to hurt Hungarian interests by imposing a ban on Russian oil imports.“As a historian, I am surprised and shocked,” Professor Miru said, recalling that Russian troops not only crushed Hungary’s 1848-49 revolt against imperial rule by Austria but also an anti-communist rebellion in 1956.The memorial in Debrecen remembering Hungarians killed by Russian troops in 1849.The New York TimesIn a speech in Budapest on March 15, a national holiday to mark the start of the 1848 revolt, Mr. Orban turned what is usually a solemn occasion into an election rally featuring a call to arms against liberal values and Western solidarity against Russia over Ukraine.He vowed to “stop at Hungary’s border the gender insanity sweeping across the Western world” and to protect Hungarian national interests against the competing interests of Russia, Ukraine, the United States and the European Union. “We must represent our own interests, calmly and bravely,” he said, without mentioning Russia’s invasion.Mr. Orban has hardly applauded Russia’s military onslaught, which his government describes as “aggression.” But neither has he criticized Mr. Putin nor joined Poland, Britain, Germany and other European countries in helping Ukraine defend itself.Irpin, Ukraine, on Friday. Previous weeks of fighting between Ukrainian and Russian forces has damaged the city, which is northwest of Kyiv, Ukraine’s capital.Daniel Berehulak for The New York TimesHis opposition to a ban on Russian oil has infuriated Poland, whose conservative governing party previously stood shoulder to shoulder with Hungary in Europe’s culture wars. It was enough to lead the Czech defense minister, Jana Cernochova, to declare last week that she was “very sorry that cheap Russian oil is now more important to Hungarian politicians than Ukrainian blood.”The Czech minister canceled a trip to Hungary for a planned gathering of the Visegrad Group, comprising four previously close Central European states. Poland and Slovakia, the other scheduled attendees, also stayed away.The leader of Poland’s governing party, Jaroslaw Kaczynski, Mr. Orban’s closest ally in the European Union, has tried to calm the rift, but even he has expressed dismay at Hungary’s fence-sitting on the war in Ukraine. “We view Hungary’s attitude with criticism, and we hope that it will become more involved,” Mr. Kaczynski told a conservative Polish weekly.Suspicion of Hungary over its ties to Moscow is so intense that some now see Mr. Orban’s nation, a member of NATO since 1999, as a weak link in the alliance.An exercise with NATO special forces troops in 2019 in Hungary. Some now consider Hungary a weak link in the alliance. The New York TimesAsked about Hungary’s hesitant support for Ukraine, Gabrielius Landsbergis, the Lithuanian foreign minister, lamented that “unwavering trust in some of our allies could be an unfortunate victim of Russia’s war against Ukraine.”Instead of rallying to help Ukraine, Mr. Orban has gone on the offensive against it, claiming on Friday that it had “made a pact” with his election rivals. This followed an earlier claim by his foreign minister, Peter Szijjarto, that the Ukrainian foreign minister, Dmytro Kuleba, recently called Ukraine’s ambassador in Budapest to “consult on the possibility of influencing the election results in Hungary” in cahoots with the opposition. Mr. Kuleba responded by accusing his Hungarian counterpart of “inventing nonsense” for “short-term benefit before the elections” and “destroying the long-term relationship between us.”Mr. Orban, hailed as a hero by many American conservatives, has taken broad steps in recent years to use his power to erode democratic norms, but his moves to revise election laws to benefit his party and mute critical voices in the media have been especially notable as the vote nears on Sunday. Opinion polls suggest Mr. Orban’s Fidesz party will again win, though it may fall short of the two-thirds majority in Parliament that had allowed Mr. Orban to rewrite the Constitution and turn Hungary into a semi-autocratic state.At a closed-door meeting on Thursday in Slovakia of nine regional foreign ministers, Mr. Szijjarto complained irritably that Hungary had been misunderstood and denied it was siding with Russia, according to a minister who was present.Seeking to rally Mr. Orban’s base ahead of the election, Mr. Szijjarto traveled the previous day to Debrecen and visited a campaign office for the Fidesz party. Asked as he was leaving whether Hungary’s policy toward Russia had left his country isolated, he shouted, “No, no, no,” and rushed out of the building to a waiting limousine.Hungary’s foreign minister, Peter Szijjarto, center, on Wednesday in Debrecen.The New York TimesFamous across Hungary as the place where anti-imperial rebels issued Hungary’s declaration of independence in 1849, Debrecen has long been associated with Hungarian nationalism. The city, said Robert Hermann, a leading Hungarian scholar of the 1848 revolution, “is our Philadelphia,” a reference to the city where rebellious American colonies declared their independence from Britain in 1776.Hungary, he added, was never as passionately hostile to Russia as Poland was, in part because Russian troops who fought in Debrecen and other rebel strongholds in the 19th century tended to treat Hungarian captives relatively well. But wariness of Moscow, amplified by its brutal crushing of Hungary’s 1956 anti-Soviet uprising, he said, still runs deep, particularly on the right.Under Mr. Orban, however, “distrust of Russia on the right went into the background,” Mr. Hermann said, as Fidesz, despite its strongly nationalist tinge, embraced a view of Russia that had previously been confined to the left. Describing himself as a “liberal nationalist,” Mr. Hermann said he had been “very confused” by Mr. Orban’s sharp tilt toward Moscow after he took power in 2010.Also confused has been Debrecen University, which in 2017 awarded Mr. Putin the title of “honorary citizen” as part of Hungary’s courtship of the Kremlin. A week after he invaded Ukraine, it issued a statement that avoided criticizing the Russian leader but subtly declared his title void, since he had not visited in person to collect it.Ukrainian refugees on Thursday at a shelter in Budapest.The New York TimesDespite first making his name as an anti-Moscow firebrand who in 1989 demanded that 80,000 Soviet troops then in Hungary go home, Mr. Orban has repeatedly spoken in recent years of the need to get along with Mr. Putin. In an interview with an Italian newspaper in 2018, he acknowledged that “in the past, we Hungarians have suffered a lot under Russia.” But he added that “it needs to be recognized that Putin has made his country great again” and that he should not be viewed as a devil “with hooves and horns” but as a leader who “rules a great and ancient empire.”Mr. Orban’s outreach to Mr. Putin has been driven in part by close cooperation on energy. Russia lent Hungary $10 billion to finance the construction of a nuclear power plant by a Russian company and provided it with natural gas at favorable prices. But there has also been a political dimension, with Mr. Orban looking to Moscow as an ally in the struggle against progressive ideas seeping in from Western Europe. Like Mr. Putin, Mr. Orban has often spoken about what he sees as the threat posed by gay men, lesbians and transgender people and their advocates.Supporters of Mr. Orban in Szekesfehervar, Hungary, on Friday during the rally.The New York TimesWhile Poland has been plastered in recent weeks with Ukrainian flags and other signs of solidarity with its eastern neighbor, streets across Hungary have been decked with placards trumpeting the need to “protect our children.” Alongside a vote on Sunday for Parliament, Hungarians are also being asked to vote on a series of inflammatory questions, like, “Do you support the promotion of sex reassignment therapy for underage children?”In early February, as fears mounted of a coming Russian invasion of Ukraine and European leaders warned of severe sanctions if an attack occurred, Mr. Orban visited Moscow to cement his country’s energy ties with Russia. For his efforts, he secured a promise from Mr. Putin that Hungary, unlike other European countries, had no need to worry about running short of natural gas.Mr. Orban described Mr. Putin’s security demands as “normal” and sanctions as pointless. The Russian president returned the favor, telling Mr. Orban that while Russia did not usually take sides in foreign elections: “You have done so much in your work on the Russia track, both in the interest of Hungary and Russia. I hope our cooperation will continue.”After Russian troops invaded Ukraine, Hungary joined fellow members of the European Union in imposing sanctions on Moscow, but it has since refused to let weapons destined for Ukraine pass through its territory and resisted efforts to impose restrictions on Russian energy imports.With television stations and many print outlets controlled directly by the state or by government-friendly tycoons, Hungary’s governing party, Fidesz, has shifted its nationalist base away from its traditional fear of Russia toward the belief that Mr. Putin stands on the same side of the barricades in defending traditional values.Outside the House of Terror, a museum in Budapest focusing on the fascist and communist governments in 20th-century Hungary. The museum is also a memorial to the victims.The New York Times“Thanks to Orban’s media, Putin is now more popular in this segment of the population than the American president or the German chancellor,” said Zoltan Biro, a Russia expert at the Corvinus University in Budapest.Speaking outside the Fidesz election headquarters in Debrecen this past week, Tibor Tisza, a taxi company owner and enthusiastic party supporter, said he had visited the local memorial to Hungarians killed by Russian troops in 1849. But he said he felt no ill will toward Russia because it “finally has a real, powerful and patriotic leader” who battles to protect children and national interests just as Mr. Orban does.Mr. Tisza said he regretted the bloodshed in Ukraine but, echoing a theme regularly promoted by Fidesz-friendly news media outlets, accused Kyiv of harboring Nazis and restricting the rights of both ethnic Russians and ethnic Hungarians to live in peace.He added that he was not against Ukraine but did not want Hungary to get sucked into its war with Russia. “If my neighbor’s house is on fire,” Mr. Tisza, “should I set my own house on fire, too?”Tomas Dapkus More