The United Nations and human rights groups voiced deep concerns Tuesday about the European Union's plans to send thousands of migrants back to Turkey amid fears the country cannot properly provide for them.

EU and Turkish leaders agreed overnight to the broad outlines of a deal that would essentially outsource Europe's refugee emergency. People arriving in Greece having fled conflict or poverty would be sent back to Turkey unless they apply for asylum.

For every migrant sent back, the EU would take in one Syrian refugee, thus trying to prevent the need for people to set out on dangerous sea journeys, often arranged by unscrupulous smugglers.

​Turkey stands to gain billions of dollars in refugee aid, faster EU membership talks and visa-free travel for its citizens within four months.

German Chancellor Angela Merkel said that under the proposed deal, which was welcomed by all 28 EU countries, migrants who enter Europe illegally will be sent back and have to join the end of the queue to enter Europe.

But the UN and rights groups are not convinced that Turkey is a safe destination. More than 2.7 million refugees, many from Syria, are in Turkey. Most are housed by Turkish families or live out in the open, and few have government-funded shelters.

"I am deeply concerned about any arrangement that would involve the blanket return of anyone from one country to another without spelling out the refugee protection safeguards," UN High Commissioner for Refugees Filippo Grandi told EU lawmakers.

"Shortsighted and inhumane"

Amnesty International warned that the plan, whose details are to be worked out at a March 17 summit in Brussels, is legally flawed. Europe's attempt to have Turkey designated as a safe country is "alarmingly shortsighted and inhumane," the group said.

"Turkey has forcibly returned refugees to Syria, and many refugees in the country live in desperate conditions without adequate housing," said Iverna McGowan, head of Amnesty's European office.

"By no stretch of imagination can Turkey be considered a 'safe third country' that the EU can cozily outsource its obligations to," she said.

The medical aid group Doctors Without Borders said the deal is cynical and a sign that "European leaders have completely lost track of reality."

"Clearly, Europe is willing to do anything, including compromising essential human rights and refugee law principles, to stem the flow of refugees and migrants," said the group's humanitarian adviser Aurelie Ponthieu.

Separately, UN Secretary-General Ban Ki-moon said he's worried by Europe's increasingly tough asylum policies, growing anti-refugee rhetoric and attacks on migrants.

"Extreme right-wing and nationalistic political parties are inflaming the situation where we need to be seeking solutions, harmonious solutions based on shared responsibilities," Ban said on a visit to Berlin.

Speaking after meeting with Merkel, Ban said he is "deeply worried by growing anti-migrant and anti-refugee rhetoric and by violent attacks against these communities."

Europe overwhelmed

The UN chief said the EU "can do much more" to manage the refugee influx, which pales next to the efforts of Turkey, Lebanon and Jordan to take in more than 5 million people between them.

Europe has been overwhelmed by the arrival of more than 1 million people in 2015 and more than 140,000 who've entered so far this year, mostly into Greece via Turkey. In response, nations along the migrant route have built barriers and tightened border controls.

Often these unilateral moves have complicated already chaotic migrant movements, putting more pressure on European neighbours and weighing on countries along the route through the Balkans north out of Greece.

Thousands of migrants are stuck at Greece's northern border with Macedonia at a makeshift and overcrowded camp near Idomeni. Many had risked their lives crossing the Aegean Sea in rickety boats.

Heavy, overnight rain had turned much of the camp into a muddy swamp, with people trying to dry their clothes and blankets at small fires.