Pope Francis followed by a security guard arrives to celebrate a mass at conclusion of the World Youth Day inKrakow, Poland, Sunday, July 31, 2016. The Mass was the final part of the World Youth Day, a global celebration of young Catholics, on the fifth day of the Pope's visit to Poland. (AP Photo/Gregorio Borgia)
Pope Francis followed by a security guard arrives to celebrate a mass at conclusion of the World Youth Day inKrakow, Poland, Sunday, July 31, 2016. The Mass was the final part of the World Youth Day, a global celebration of young Catholics, on the fifth day of the Pope's visit to Poland. (AP Photo/Gregorio Borgia) Credit: Gregorio Borgia

Pope Francis encouraged hundreds of thousands of young people at a global gathering Sunday to “believe in a new humanity” that is stronger than evil and refuses to see borders as barriers.

His appeal came at the end of World Youth Day, a weeklong event held in southern Poland this year that draws young Catholics from around the world every two to three years to a different country for a spiritual pep rally.

The youth gathering was Francis’s main focus during his pilgrimage to Poland, but over five days in the deeply Catholic nation he also prayed in silence at the former Nazi Auschwitz death camp and implored God to keep away a devastating wave of terrorism now hitting the world. He also met with Poland’s political and church leaders.

For the second straight day, a huge crowd filled a vast field Sunday in the gentle countryside outside the city of Krakow to see Francis, who was visiting central and eastern Europe for the first time.

Security was very tight throughout the pope’s five-day visit, but he encountered huge crowds day after day without incident and headed home to Rome late Sunday on a Polish plane.

Many of the faithful had camped out overnight after an evening of entertainment and prayer with the pope in the same field Saturday night that drew 1.6 million people, according World Youth Day organizers.

Sunday’s faithful numbered at least in the hundreds of thousands. The Rev. Federico Lombardi, a Vatican spokesman, referred to an estimate by Polish authorities of 1.5 million at Sunday’s closing Mass.

The pope used his several encounters with the young pilgrims – from mega-gatherings to a private lunch with only a dozen people from five continents – to encourage a new generation to work for peace, reconciliation and justice.

God, said Francis in his final homily of the pilgrimage, “demands of us real courage, the courage to be more powerful than evil, by loving everyone, even our enemies.”

“People may judge you to be dreamers, because you believe in a new humanity, one that rejects hatred between peoples, one that refuses to see borders as barriers and can cherish its own traditions without being self-centered or small-minded,” Francis told his flock.

Later Sunday, on his way to the airport, Francis met with hundreds of young volunteers to thank them for their work. He had a speech prepared but looking at the pages in his hand with annoyance he said, “five pages?” and then began speaking freely in his native Spanish.

“Do you want to be hope of the future?” he asked, getting an enthusiastic “Yes!”

Earlier in his pilgrimage, Francis had expressed dismay that many people and places aren’t welcoming enough to refugees or those fleeing poverty in their homelands.

After over 1 million people arrived on Europe’s southern shores last year, some nations on the continent, notably in central and eastern Europe, hastily built fences to keep the refugees out. Poland has been among the EU countries that have refused to take in many Muslim refugees, saying it has already welcomed hundreds of thousands of Ukrainian immigrants.