Pope Francis exchanges greetings with Polish President Andrzej Duda during a meeting with government authorities and the diplomatic corps in the courtyard of Wawel Royal Castle in Krakow, Poland, July 27. (CNS/Paul Haring)
Story updated at 3:41 p.m. CT
Pope Francis issued a challenge to Polish leaders on the first of a five-day visit to the country Wednesday, asking the government of the eastern European nation to be more welcoming to migrants fleeing persecution and war.
The pope addressed President Andrzej Duda and the country's political elite, saying that the "complex phenomenon" of the millions of people coming to Europe from the Middle East and North Africa requires the Polish people "to overcome fear and to achieve the greater good."
"Needed is a spirit of readiness to welcome those fleeing from wars and hunger, and solidarity with those deprived of their fundamental rights, including the right to profess one’s faith in freedom and safety," the pope exhorted.
Some might see Francis' remarks as a challenge to Poland’s ruling Law and Justice party, which has blocked the door to most asylum seekers and also balked at European Union efforts to adopt a quota system for countries in the 28-member bloc to accept migrants.
Speaking in the historic 14-century Wawel Castle, an expansive red-roofed Gothic campus that was once the center of Polish governments, the pope asked the country's people to adopt a culture of hope and trust.
He encouraged Poland, where 87.5 percent of people identify as Catholic, to look to God who "guides the destinies of peoples, opens closed doors, turns problems into opportunities and creates new scenarios from situations that appeared hopeless."
The pontiff is visiting Poland Wednesday-Sunday for the 14th World Youth Day. He arrived in Krakow, the historic city in southern Poland near the country's borders with Slovakia and the Czech Republic, to throngs of cheering crowds.
As Francis took the popemobile to Wawel from the city's airport, named for predecessor Pope John Paul II, people lined the route waving flags and banners.
News of Francis' arrival spread across Tauron Arena, where English-speaking catechesis will be taking place throughout World Youth Day, and pilgrims flooded the main arena to catch a glimpse of him.
Pilgrims, watching from a live stream in the arena, anxiously awaited the pontiff to exit his plane. Groups continuously lead chants of "Papa Francisco" for five minutes. As soon as the pope exited the plane, chants made way to clapping and screaming, some pilgrims wiping tears from their faces.
Caitlin McHenry was one of the pilgrims who had an emotional reaction. McHenry, a high schooler from Dartmouth, Mass., said that she almost cried when she saw the pope.
"He traveled so far to be with the youth," she said. "I feel so blessed to have him here."
Security for the pope's visit and World Youth Day, which organizers say may attract crowds in the millions by Sunday, has been extraordinarily tight. On the eve of Francis' arrival, security forces were highly visible throughout Krakow.
Related: Police raise security threat level in Krakow but say no concrete danger (July 26, 2016)
At Blonia Park in particular, where the opening Mass for World Youth Day took place Tuesday, Polish police, military and K-9 units could be seen patrolling the massive field while helicopters hovered above and snipers took positions on the tops of buildings.
After speaking to the country's political leaders Wednesday, Francis had a private meeting with the Polish bishops at the Cathedral Basilica of Sts. Stanislaus and Wenceslaus.
The meeting was initially announced as a public encounter, but the Vatican changed course several weeks ago saying the pontiff preferred an opportunity to speak to the country's prelates behind closed doors.
John Paul's legacy is expected to loom large over the continuing visit. The late pontiff served as the archbishop of Krakow from 1964-78 and was born about 30 miles southwest of the city in the small town of Wadowice.
Francis is staying at the archbishop’s palace, where John Paul lived as archbishop.
John Paul stayed in his old room at the palace when he visited Poland as pontiff, greeting people outside from his window each night. That window now has a tall photo of the Polish pontiff pasted on it, allowing passers-by to imagine him still there.
Late Wednesday evening, Francis came to the window to greet thousands of young people who had packed outside in hopes he would say hello. The pontiff spoke to them about Maciej Szymon Cieśla, a 22-year-old Polish World Youth Day volunteer who died from cancer just weeks before the start of the event.
After asking those outside to pray for Cieśla, the pope said: "Life is so, dear young people."
"But there is a thing that we cannot doubt," he continued. "The faith of this young man -- of this our friend who worked hard for this WYD -- brought him to heaven and he is with Jesus now and looks over all of us."
Francis' visit continues Thursday with a visit to Czestochowa, about 90 miles northwest of Krakow.
While there, the pontiff will visit the chapel of the famous Black Madonna, a 14th-century icon that is venerated throughout the country. He will also celebrate a public Mass for the 1,050th anniversary of the Christianization of Poland.
On Friday, Francis will visit the World War II concentration camps of Auschwitz and Birkenau, about 45 miles west of Krakow.
[Joshua J. McElwee is NCR Vatican correspondent. His email address is jmcelwee@ncronline.org. Follow him on Twitter: @joshjmac. Kristen Whitney Daniels is an NCR Bertelsen intern. Her email address is kdaniels@ncronline.org.]