BUDAPEST Like most members of Hungary's liberal intellectual elite, George Konrad, a distinguished novelist, loathes his country's stridently illiberal prime minister, Viktor Orban.
"He is not a good democrat and I don't believe he is a good person," said Mr. Konrad, a veteran of communist-era struggles against dictatorship.
All the same, he thinks Mr. Orban, the self-declared scourge of mainstream elites across Europe, was right and Chancellor Angela Merkel of Germany was wrong about how to respond to the chaotic flood of migrants seeking refuge from war and poverty perhaps Europe's most serious crisis since World War II.
"It hurts to admit it, but on this point Orban was right," Mr. Konrad, 82, said, lamenting that in the absence of a joint European effort to control the flow, Hungary was wise to seal its borders and sound the alarm over the perils of allowing hundreds of thousands of migrants, mostly Muslims, to enter Europe willy-nilly.
Quietly, and often with similar misgivings, a growing number of people in Hungary and beyond are wondering whether, despite his shrill and often bigoted message, Mr. Orban had a clearer view of the scale of the migration crisis and its potential hazards than technocrats in Brussels and leaders in Berlin and other European capitals.
In fact, Mr. Orban's prescriptions notably the need to secure Greece's porous coastline and seal Europe's outer borders have slowly been embraced by other European Union leaders, who vowed on Thursday, at their final summit meeting of 2015, to "regain control" of the Continent's frontiers.
Speaking in Brussels at the end of the summit meeting on Friday, Mr. Orban said that "it has taken us a long time" but that there was now "an absolute consensus among the prime ministers on the issue of protection and control of the external borders." With a big grin, he added, "Actually it was Hungary's point of view since the beginning that we should start here."
While repelled by much of the hate-mongering that has accompanied Mr. Orban's positions, European leaders have nonetheless begun to echo him on many points, albeit without his nasty snarls. The shift reveals just how far the debate around migrants and asylum seekers has turned, particularly since revelations that a few of the terrorists who killed 130 people in Paris on Nov. 13 had entered Europe in the tide of refugees.
In a recent interview with European newspapers, Donald Tusk, president of the European Council, the body that presides over European Union summit meetings, described Ms. Merkel's welcoming approach to migrants as "dangerous" and endorsed the view long promoted by Mr. Orban that most of the asylum seekers entering Europe were not Syrians fleeing war but economic migrants seeking jobs.
Emphasizing the need to secure Europe's external borders, another longstanding Hungarian demand, he suggested that asylum seekers be detained for up to 18 months to give the authorities time to identify and send back economic migrants.
"This shows how far the European mainstream is now moving in another direction," said Peter Kreko, director of the Political Capital Institute in Budapest, an independent research organization. "It is moving closer to what Orban represents."
As proof, he pointed to the recent election victory in Poland of the ultraconservative and conspiracy-minded Law and Justice Party, the strong showing of France's far-right National Front in the first round of regional elections and the crumbling across Scandinavia of a pro-migrant consensus.
Peter Szijjarto, Hungary's foreign minister, said that in his meetings with fellow European ministers the tone had changed drastically since the summer, when Hungary was repeatedly denounced for building a fence to seal off its southern border to migrants hoping to get to Germany.
Fences and other obstacles have since become the norm across much of Europe, with even Sweden, traditionally Europe's most welcoming country for refugees, announcing tough border controls.
"It is more and more obvious that what we kept on saying for the last six months turned out to be right," Mr. Szijjarto said in an interview. "This is acknowledged more and more: Some say it openly, some say it behind closed doors and some don't say it but act accordingly."
Open support for Mr. Orban and his approach, which has mixed effective practical measures to slow the flow of migrants with bizarre conspiracy theories tinged with racism and anti-Semitism, remains mostly limited to Europe's political fringe.
On a visit this month to Estonia, for example, Mr. Szijjarto heard lavish praise for his boss, Mr. Orban, from the Conservative People's Party, a nationalist opposition outfit with a simple message for nonwhite migrants: "If you are black, go back."
The most that mainstream politicians will say is that "Orban wasn't completely wrong," as Reinhold Mitterlehner, Austria's Conservative vice chancellor, remarked recently.
Officials in Brussels, the headquarters of the European Union, acknowledge in private that Mr. Orban got many things right, but they say that he and his supporters undermined their case with belligerent tirades that variously cast the influx of asylum seekers as a Muslim invasion, a conspiracy by European socialists to import future left-leaning voters and a plot by the Hungarian-born Jewish philanthropist George Soros to undermine European nation states.
At a congress over the weekend of the governing Fidesz party, Laszlo Kover, an Orban loyalist and the speaker of the Hungarian Parliament, thundered against multiculturalism as "some kind of experiment" to turn Europe into a "territory for rootless barbarian hordes."
Tamas Lanczi, the director of the Center for Political Analysis at Szazadveg, a Budapest research group tied to Hungary's governing party, said: "The European elite is very angry with Orban because he spoiled their game. He called out the name of the emperor who is naked."
Mr. Orban, he added, has been demonized "as the Devil himself," but his views are "now becoming the mainstream" because he "refuses to walk down the one-way street of political correctness."
Istvan Gyarmati, a retired Hungarian ambassador who dislikes his country's illiberal direction under Mr. Orban, said the shift in mood stemmed in large part from the manifest failures of the European Union to get a grip on the migrant crisis and its tendency to put wishful thinking ahead of realistic policy.
"There is a shift to the extreme right because the left, or what is left of the left, and the moderate center right were offering answers that were wrong," said Mr. Gyarmati, who heads the International Center for Democratic Transition, a group that promotes democracy. "Now we are in a situation where the answers are unpleasant to say the least."
The centerpiece of Europe's common response to the migrant crisis has been a well-intentioned but so far utterly unworkable plan to spread 160,000 migrants who land in front-line states like Greece around the Continent under a quota system.
Introduced seven months ago with strong backing from Berlin by the European Commission, the union's executive arm in Brussels, the plan has relocated only 208 people, stirred months of divisive recrimination and left the 28-nation union in disarray.
Even as it has moved closer toward his policies, the European Commission, fed up with Mr. Orban's mocking of its impotence, announced in early December that it would take Hungary to court over legislation it adopted in September that made it difficult for asylum seekers to appeal speedy rejections of their applications and other alleged violations of European rules.
Mr. Szijjarto, the Hungarian foreign minister, dismissed the move as "revenge" for Hungary's own decision to challenge the quota-based relocation plan at the European Court of Justice.
The recent disclosure by the Belgian authorities that Salah Abdeslam, a suspected participant in the Nov. 13 Paris attacks, traveled to Hungary to collect two accomplices who entered Europe on the migrant trail has unleashed another burst of "told-you-so" comments in Budapest.
The Hungarian government distorted what happened, claiming against all evidence that the accomplices picked up by Mr. Abdeslam were themselves refugees. But the fact that terrorists appear to have entered Europe concealed among asylum seekers still vindicated repeated warnings by Mr. Orban that the uncontrolled flow of so many people posed serious security risks.
"Whenever Hungary made an argument the response was always: 'They are stupid Hungarians. They are xenophobes and Nazis,' " Zoltan Kovacs, a government spokesman, said. "Suddenly, it turns out that what we said was true. The naïveté of Europe is really quite stunning."
Helene Bienvenu contributed reporting.