Receive the latest national-international updates in your inbox

Pope Francis waves to the crowd as he arrives for his weekly general audience in St. Peter's Square at the Vatican, Wednesday, May 18, 2016.

Support for migrants is so central to Pope Francis' vision for the church that he has made welcoming them a potential test for those seeking entry to Heaven on Judgment Day.

The pontiff's advocacy for refugee rights faces a diplomatic test Wednesday when he begins a five-day visit to Poland, where a populist government has slammed the door on most asylum-seekers.

Francis is scheduled to meet Polish President Andrzej Duda in Krakow's millennium-old castle atop Wawel Hill where, in the neighboring cathedral, Polish national heroes for centuries have been laid to rest. He then will hold a question-and-answer session with Poland's bishops behind closed doors.

Ahead of the pope's arrival, Polish Interior Minister Mariusz Blaszczak defended the ruling Law and Justice party's opposition to immigration by citing the Bastille Day truck massacre of 84 people in Nice, France. Blaszczak argued that such violence was an inevitable consequence of multiculturalism.

Top Photos From Pope Francis' U.S. Visit

The pope suggests that reluctance or refusal to shelter newcomers in need conflicts with the parable of the Good Samaritan, who offered aid to a robbed, wounded stranger.

Addressing the faithful last month in St. Peter's Square, Francis said that ultimately "we will be judged on the basis of works of mercy."

"The Lord will be able to say to us: 'Do you remember? That migrant, who so many wanted to kick out, was me.'"

Seeking to inspire by example, Francis in April brought 12 Syrians back with him to Rome after visiting a migrant camp on the Greek island of Lesbos, where tens of thousands were stranded after perilous crossings from nearby Turkey in often overcrowded boats.

The Rev. David Hollenbach, a professor of ethics at Georgetown University's School of Foreign Affairs in Washington, said the pope's championing of migrants is "politically important and socially important, but also religiously important to the identity of Christianity." Hollenbach, who like Francis is a Jesuit, said in a telephone interview that the treatment of migrants and foreigners is "central in the Bible."

Returning in February from a pilgrimage to Mexico, Francis told reporters aboard his plane: "I think that a person who thinks of building walls and not bridges isn't Christian." The pope was responding to a question about Donald Trump, the Republican U.S. presidential candidate, who says he wants to build a border wall to bar Mexicans from the United States.

A Polish commentator, Adam Szostkiewicz, said he expected the pope to raise Poland's opposition to aiding refugees during this week's visit because "this is the central theme of his pontificate in Europe. This is a European problem."

Szostkiewicz said he expected the pope to argue against Poland's policy, which he compared to Pontius Pilate's attitude to the crucifixion of Jesus: "We wash our hands. This does not concern us." But he forecast that any papal appeal would spark only a momentary stir, not any shift in government policy.

"It will be good if he says it, and it will be commented on, but it will soon be forgotten," he said.

Catholic figures in Poland have been widely seen to reinforce the government's nationalist views. University of Maryland history professor Piotr Kosicki recalled how a Polish priest railed against Muslims, Jews and "leftists" during an address to an Independence Day rally in Warsaw in November. Kosicki, writing in the Catholic magazine Commonweal, concluded that the priest, Jacek Miedlar, represented "a nationalist revival for which being Catholic and Polish implies also being anti-European, anti-pluralist and anti-liberal."

Some within the church have been struck by how Poland's anti-migrant stand is equated with protecting the country's Polish and Catholic identity.

"Turning away the refugees would not have been so readily accepted by our society had it not been done in the name of the defense of Christianity and of being Polish," wrote the Rev. Leon Wisniewski, a Dominican friar, in the Catholic intellectual weekly Tygodnik Powszechny.

At the Vatican, the visiting spokesman for Poland's bishops conference was asked by The Associated Press how Poland and the Polish church might react to Francis' insistence on welcoming migrants.

"It's not a black and white question," said the Rev. Pawel Rytel-Andrianik, who stressed that Poland has taken in refugees, most of them from countries with predominantly Christian backgrounds. He said Polish bishops had issued their own appeal for parishes to shelter refugees the day before Francis, in September 2015, similarly called on each parish to host a family of refugees.

Most of Poland's refugees come from Russia, Ukraine and other neighbors in the former Soviet Union, not from Syria, Afghanistan, Iraq or Africa, major sources for people trying to gain European Union protection. The right-wing Polish government elected in October has refused to observe an EU-wide agreement on sharing the burden of accommodating tens of thousands of asylum seekers largely stuck in Italy and Greece.

Analysts see a wide gulf in Polish attitudes to Francis and to the only Polish pope, John Paul II, whom Francis canonized in 2014. While John Paul was beloved by Poles for his staunch defense of the Solidarity labor movement that helped to topple Soviet rule in 1989, many Poles don't relate to Francis' world view.

Kosicki told The AP in a telephone interview that "the substance of what he says doesn't compute for the vast majority of Poland."