Migrants stand around a fire in a makeshift camp in the village of Roszke, Hungary, on Sept. 7. (Marko Djurica/Reuters)

THE EUROPEAN Union is failing to live up to its fundamental values and commitment to human rights in its response to a wave of refugees from Syria and elsewhere. Instead, it is allowing its policy to be hijacked by one of its smallest members, Hungary, whose prime minister is acting on a hateful ideology more in keeping with the Europe of the 1930s than that of the 21st century.

On Wednesday, Hungarian security forces fired tear gas and water cannons across its border with Serbia in a brutal effort to turn away thousands of desperate refugees who had gathered outside the razor-wire fences it has thrown up. Its authoritarian-minded government has just rushed through new laws making the crossing of its border by asylum seekers a criminal act — measures that are at odds with international law. It is refusing to go along with an E.U. plan to redistribute 160,000 refugees across the union, even though more than 50,000 of them would be taken from Hungary itself.

Right-wing Prime Minister Viktor Orban, who has long cast himself as an opponent of Western liberalism, has been painfully clear about why he is pursuing these abhorrent policies. It is not because the wealthy European Union cannot find room for several hundred thousand refugees, when poor countries such as Lebanon and Jordan are taking in millions. Clearly, it can; Germany alone has said it can resettle up to 800,000. Nor is it because the fleeing Syrians have connections to terrorist organizations — most are secular members of the country’s former middle class, or members of minority sects.

Rather, Mr. Orban says openly that their aim is to protect Christian Europe from a wave of Muslims. He says, “Hungarians must make every effort for the defense of their freedom, their culture and their customs.” And not only Hungary: Mr. Orban opposes allowing Muslim migrants into any other part of Europe, which is why he blocks the border even though most of those seeking to cross have no intention of remaining in his country.

It is with reason that Austria’s leader has compared Mr. Orban’s stance to that of European fascists during “the darkest period of our continent.” Said Chancellor Werner Faymann: “To divide human rights by religions is intolerable.” Yet thanks to Hungary’s position astride one of the main routes followed by the refugees into Europe, Mr. Orban’s doctrine is rapidly becoming Europe’s de facto policy.

That should not be allowed to stand. German Chancellor Angela Merkel has tried to lead the European Union toward a more humane policy, one that would offer harbor to legitimate refugees while rejecting economic migrants and cracking down on smuggling networks. Ms. Merkel has rightly defined the refu­gee crisis as a crucial test for Europe as well as a humanitarian crisis, saying “if Europe fails on the question of refugees . . . then it won’t be the Europe we wished for.” Germany is pressing for an E.U. summit next week where it will seek to override the resistance of Hungary, the Czech Republic and other opponents of resettlement.

However, tougher steps may be needed to stop Mr. Orban from imposing his agenda of intolerance. Austrian and German officials have suggested that generous E.U. subsidies to Hungary should be reconsidered; the union also has the option of suspending Budapest’s voting rights. One way or another, the European Union must make clear its rejection of Mr. Orban’s repellent policies.