Hungary said Wednesday it was building a barrier on its border with Serbia to keep out migrants, as the EU struggles to deal with the massive flow of people trying to reach Europe.
Serbian Prime Minister Aleksandar Vucic said he was "surprised and shocked" by the plan. "We will discuss this decision with our Hungarian colleagues," he added.
The move was announced as Pope Francis hit out at nations that "close the door" to those seeking a safe haven from war, poverty and persecution.
And France said it was "doing its part" by creating 10,500 new housing units for asylum seekers and immigrants.
In Budapest, Foreign Minister Peter Szijjarto said Hungary's government has ordered work to start on a four-metre (13-foot) high fence along the length of its 175-kilometre (110-mile) border with Serbia.
"This decision does not break any international treaty, other countries have opted for the same solution," he said, citing similar barriers on the Greek-Turkish and Bulgarian-Turkish frontiers and around Spanish exclaves in Morocco.
Serbia is not part of the European Union, while EU member Hungary is in the passport-free Schengen zone. Once inside Hungary, migrants can therefore travel easily elsewhere in the 26-nation zone.
Hungary says around 95 percent of the tens of thousands of migrants to have entered the country so far this year came through Serbia.
Last year, Hungary received more refugees per capita than any other EU country apart from Sweden.
And Prime Minister Viktor Orban has sparked accusations of xenophobia over anti-immigration comments and a poster campaign with slogans such as "If you come to Hungary, you cannot take Hungarians' jobs."
Serbia's Interior Minister Nebojsa Stefanovic called on neighbouring Bulgaria and Greece -- both EU members -- to "make more of an effort" to stop migrants entering the former Yugoslav republic.
More than 100,000 migrants have arrived in Europe this year, 60,000 through Italy alone, according to the EU's border agency Frontex.
Szijjarto said that with EU efforts towards a satisfactory joint approach proving to be "long and time-consuming", Hungary "cannot afford to wait any longer".
On Tuesday, European interior ministers failed to come to a decision on European Commission proposals to redistribute 40,000 Syrians and Eritreans who have arrived in Europe, and to resettle 20,000 Syrians living in camps outside Europe.
"We have made progress today but we are not there yet," EU migration commissioner Dimitris Avramopoulos said after the talks in Luxembourg. "Words are not enough."
Leaders had promised action after an estimated 800 migrants died in a shipwreck in April, the worst disaster yet in the Mediterranean in a year in which 1,800 people have perished trying to cross from Africa and the Middle East on flimsy boats.
Italy together with crisis-hit Greece are receiving the bulk of the migrants. Under the EU's Dublin accords, the country where migrants are first registered is where they have to stay.
Rome wants other countries to take in some of the migrants, with Prime Minister Matteo Renzi warning of a "plan B" that would "hurt Europe" if other countries fail to help.
Italian media reported that Rome could start issuing newly arrived migrants with temporary visas giving them the right to travel throughout the Schengen zone.
"The principle of responsibility and solidarity are at stake," Italian Interior Minister Angelino Alfano said Tuesday. "We are working to prevent Europe from becoming politically bankrupt."
Britain, Ireland and Denmark are already exempt from carrying out the plans under EU treaties, but many of the other 25 member states reject quotas under pressure from anti-immigrant parties.
EU leaders will hold fresh talks at a summit in Brussels on June 25-26 but a decision then is also unlikely.
UN rights chief Zeid Ra'ad Al Hussein on Monday called for the EU to take in one million refugees, while Amnesty International slammed leaders for "condemning millions of refugees to an unbearable existence".
On Wednesday Pope Francis added his voice to these calls, demanding greater respect for "our brothers and sisters who seek refuge far from their own lands".
"And I invite everyone to ask God's pardon for those people and institutions who close the door to those who are seeking a family, who are seeking to be protected," he said.
In France, Interior Minister Bernard Cazeneuve announced 5,000 new housing units for people granted asylum in France, 4,000 for asylum seekers and 1,500 emergency slots for illegal immigrants.
In seven years, the number of asylum seekers has nearly doubled in France to reach more than 66,000 cases in 2013.
As a result, there is a severe lack of housing facilities and half of all asylum seekers have to fend for themselves, resorting to living in slums, squats or sleeping rough.