The “ruinously selfish” behaviour of some member states towards refugees has brought the European Union to its knees, former attorney general Peter Sutherland has said.

In a sharp denunciation of Europe’s failures on migration and social integration, Mr Sutherland, who is special representative to the United Nations secretary general for migration, said political “paralysis and ambivalence” was threatening the future of the EU and resulting in the rise of xenophobic and racist parties.

With a population of 508 million, the EU should have had no insuperable problem welcoming even a million refugees “had the political leadership of the member states wanted to do so and had the effort been properly organised,” Mr Sutherland said. “But instead, ruinously selfish behaviour by some member states has brought the EU to its knees.”

There were several “honourable exceptions”, most notably German chancellor Angela Merkel, who he described as “a heroine” for showing openness and generosity towards refugees.

Mr Sutherland made the remarks in the Littleton memorial lecture, which was broadcast on RTÉ radio on St Stephen’s Day.

More than a million refugees and migrants arrived in the EU by land and sea in 2015, according to the International Organisation for Migration, making this the worst crisis of forced displacement on the continent since the second World War. Half of those arriving were Syrians fleeing a conflict that has left almost 250,000 people dead and displaced half the country’s pre-war population.

A European Commission plan to use quotas to relocate asylum seekers arriving in southeastern Europe was adopted in the autumn against strong opposition from several states, including Hungary, Poland and the Czech Republic. Slovakia said it would take in only a few hundred refugees, and they would have to be Christians.

Mr Sutherland said the razor and barbed wire fences being erected on the Hungarian border to keep out migrants and refugees “are not just tragic but they are also particularly ironic, as Hungarians were for so long confined by the Iron Curtain.” He recalled that in 1956, after their failed revolution, 200,000 Hungarian refugees were immediately given protection throughout Europe and elsewhere.

“Yet now, prime minister Viktor Orbán is the most intransigent and vociferous opponent of taking refugees in the EU.”

Mr Sutherland accused some heads of government of “stoking up prejudice” by speaking of barring Muslim migrants and said the absence of EU agreement on a refugee-sharing scheme meant a Europe of internal borders was increasingly likely to become a reality across the continent.

“This is a tragedy. Tension between member states is inevitably going to grow because of the great differences among them in their attitudes towards refugees,” he said.

“It is hardly surprising that Germans, who will take about a million refugees this year, and who have promised to take 500,000 annually for the next few years, should be outraged by, for example, the United Kingdom’s paltry offer of 20,000 places over five years - and this by a country that has only resettled 252 Syrian refugees since the conflict began.”

On the way forward, Mr Sutherland said EU member states would be wise to take a “bold step” towards a single European border agency and, eventually, a single European asylum agency. Europe had to properly fund organisations such as the World Food Programme, which was feeding refugees in sprawling camps in Jordan, Lebanon and Turkey.

He said it was immoral that the only pathway Europe offered to desperate refugees to access protection was to cross the perilous Mediterranean at great cost and risk of death. “We must offer safe passage for those we ultimately will accept,” he said.

“How can we, for example, reject Muslin refugees fleeing ISIS and leave them to die on beaches or in frozen rivers in the Balkans? How can we lock them into camps? It is worth recalling that ISIS considers refugees fleeing Syria and Iraq as the worst kinds of traitors to their cause of building a modern-day Caliphate so they cannot go back.”

Mr Sutherland added that evidence of ghettoisation of Muslim communities in some countries should act as an incentive to put real effort and resources into integrated education.