Pope Francis said on Sunday that political leaders who want walls and other barriers to keep migrants out "will end up becoming prisoners of the walls they build".
The pope made his comments to reporters aboard the plane returning from Morocco in response to a question about migration in general and about U.S. President Donald Trump's threat to shut down the southern border with Mexico.
"Builders of walls, be they made of razor wire or bricks, will end up becoming prisoners of the walls they build," he said.
Francis, who did not mention Trump in his response, has sparred with the U.S. president before over migration, which was a theme of several questions on the plane as well as during the trip to Morocco.
Trump has declared a national emergency to justify redirecting money earmarked for the military to pay for his promised U.S.-Mexico border wall.
"I realize that with this problem (of migration), a government has a hot potato in its hands, but it must be resolved differently, humanely, not with razor wire," the Argentine-born pope said on the plane.
Addressing Moroccan leaders on Saturday, Francis said that problems of migration would never be resolved by physical barriers but instead required social justice and correcting the world's economic imbalances.
- Benjamin Netanyahu, the undertaker of the two-state solution
- Network of fake social media accounts boosting Netanyahu ahead of election, report says
"With fear, we will not move forward, with walls, we will remain closed within these walls," he said on Sunday.
Besides the United States, migration has again risen to the fore of national political debates in a number of North African and European countries.
On the plane, Francis repeated some of the key points of his views on migration.
He said wealthy countries should help eliminate the root causes of migration such as poverty, war and political instability.
Migrants should be accepted, protected and integrated and if a country cannot handle the numbers, the migrants should be distributed among other countries, he said.