Prime Minister Viktor Orban was never much of a liberal. A former US ambassador recently quoted him as saying: "All this talk about democracy is bullshit" after one too many lectures regarding his authoritarian ways.
Yet even by his own reactionary standards, the building of a heavily fortified fence along the country's southern border, patrolled by sniffer dogs and possibly the army, looks like an extreme step -- particularly in a country with vivid memories of the Soviet Union's Iron Curtain.
The UN's refugee agency said new laws due to come into force next week, threatening three years in jail for anyone breaking through the barrier, "could lead to chaos", while French Foreign Minister Laurent Fabius called the fence a breach of "Europe's common values".
Orban has dismissed the criticism and ridiculed EU calls to distribute refugees around the continent.
"As long as we can't defend Europe's outer borders, it is not worth talking about how many people we can take in," he said in a speech this week.
Taking the law into their own hands
The heavy-handed tactics may be unpopular in Brussels, but there is nonetheless a recognition that Hungary is a victim of Europe's failed response to the migration crisis, which has seen more than 380,000 people enter the continent this year.
In particular, the influx may have put the final nail in the coffin of the EU's widely-derided "Dublin Regulation", under which asylum seekers must register in the first country they reach, putting enormous pressure on Greece, Italy and Hungary.
"In practice, the Dublin regulations have already died," Gauri van Gulik, deputy Europe director for Amnesty International, told AFP.
"The idea that you can stop people going where they want is ludicrous. What you see on the ground, especially in Hungary, is it's simply impossible for them to process all the people arriving and provide basic reception facilities, so people are taking the rules into their own hands."
Hungary has already seen 162,000 people crossing its borders illegally this year, with most trying to reach Germany and Sweden to the north after an arduous journey through Greece and the Balkans.
'Doesn't look good for him'
Orban's tough stance is partly an attempt to undercut Jobbik, considered one of the most extreme of the emerging far-right parties in Europe, which won 17 percent of the vote in elections last year.
"Orban is stuck between a rock and a hard place," said Blanka Kolenikova, an expert on central Europe at IHS, a London-based consultancy.
"Whatever he does to slow down the traffic of migrants will be unpopular with human rights campaigners, but he faces domestic pressures and security concerns. Hundreds of people walking the highways does not look good for him."
One of the most worrying aspects of the migration crisis, she said, is that it is bringing together far-right parties from Hungary and neighbouring Slovakia for the first time.
"It is incredible because they hate each other," said Kolenikova.
"We are likely to see more protests by Jobbik, maybe backed by groups from Slovakia, Poland and the Czech Republic. That will put extra pressure on Orban and make him even more explosive in his comments and actions."
"Orban has lost control"
Supporters, such as Tamas Lanczi of pro-government think tank Szazadveg, say Orban is just a "useful scapegoat" for Brussels and that many EU leaders share his concerns about migrants.
But the bitter irony for Orban is that his ultranationalist rhetoric may come back to haunt him.
By fuelling anti-immigrant fears with claims that "tens of millions" are descending on the country, he now risks looking incompetent as the clampdown fails.
"Orban's inability to cope with this crisis effectively is a big problemfor him, and it plays well for Jobbik," said Kolenikova.
The razor-wire barrier completed on August 29 has failed to stop any migrants, while the slow pace of fence-building apparently prompted the resignation of Defence Minister Csaba Hende on Monday.
"Orban has lost control of the situation", said Budapest analyst Peter Kreko.
"He has tarnished the reputation of the government due to the chaotic
situation... and he has isolated himself at the international level."