German leader Angela Merkel has chided Hungarian Prime Minister Viktor Orban over migration, saying they should not forget the issue was about people.
At a joint news conference in Berlin, she said if Europe wanted to retain its soul it could not ignore people's needs and suffering.
But Mr Orban said the best way to be humane was to close borders and help the countries that migrants came from.
EU leaders reached a deal on migration last week.
However, differences remain over its implementation.
The two leaders embody the EU's split over migration. Germany allowed a million people to enter in 2015, while Hungary has so far rejected a scheme to relocate 160,000 refugees from overcrowded camps in Greece and Italy.
Mrs Merkel said Europe should protect its borders but without becoming "some sort of fortress".
"I believe - and this is the difference - Europe's soul is humanity. And if we want to keep that soul, if Europe and its values wants to succeed in the world, then it must not close itself off," she said.
Mr Orban said it was essential to remove pull factors that he said were encouraging people in Africa and Asia to migrate.
"If we want to act humanely, then there must be no pull-factor. And there is only one solution: closing off of the borders, and bringing the support over there. And not let those in who bring problems," he said.
On Wednesday Mrs Merkel agreed to tighten controls at the Austrian border to stop people who have applied for asylum in other EU countries from entering Germany.
The deal with her Interior Minister Horst Seehofer, who leads her party's Bavarian CSU allies, was aimed at defusing a row that had threatened to break up her four-month-old coalition government.
But this is also causing some disagreement. Austrian Chancellor Sebastian Kurz - who is sharing power with a far-right party - has agreed with Mr Seehofer that Austria will not be responsible for migrants turned back at the German border.
Mr Orban said that Hungary would refuse to take back migrants who had travelled through the country - even if they had registered in Hungary and not in Greece.
"We think that the people Germany is sending back must go to Greece and not Hungary. That will be a long legal dispute, and we are ready for it," he said.
Mr Sehofer said he would hold talks with Italy and Greece about sending back migrants who had been registered there.
However German media report that most of the irregular migrants entering Germany do not go through Austria anyway. About three-quarters of the 18,000 people to have entered Germany took alternative routes.
About 56,000 migrants have arrived in Europe so far this year, the International Organization for Migration says. More than a million people arrived in 2015.
What did EU leaders agree last week?
They reached a deal after marathon negotiations in Brussels, but they have since differed sharply on how the plan would be implemented. The measures they agreed on included:
- Exploring the possibility of "regional disembarkation platforms", designed to thwart people-smuggling gangs by processing migrants outside the EU
- Setting up secure migrant processing centres in EU countries, although no country has yet volunteered to host one. Mr Macron said France would not host one as it was not a country where migrants landed but Italian Prime Minister Giuseppe Conte said the centres could be anywhere in the EU
- Strengthening external border controls, with more funding for Turkey and countries in North Africa
- Boosting investment in Africa to help the continent achieve a "socio-economic transformation" so people no longer want to leave in pursuit of a better life in Europe