By Philip Pullella
KRAKOW, Poland (Reuters) - Pope Francis wrapped up his Polish visit on Sunday with a huge outdoor Mass where he told young people to look beyond the instant gratification afforded by technology, and instead to try to change the world.
Hundreds of thousands of young people, many of whom camped out for the night, waved national flags and cheered as Francis arrived to say the Mass in a large field on the outskirts of Krakow at the end of his five-day trip to Poland where he presided at the Catholic Church's World Youth Day festivities.
Francis, 79, who has said he is a "disaster" with technology, sprinkled his sermon at the last major event of the trip with social media and technology terms.
He urged the young people to "'download' the best 'link' of all, that of a heart which sees and transmits goodness without growing weary."
He said their response to the challenges of life cannot be "texting a few words," that prayer should be given pride of place over their internet "chats", and that God's memory was not a "hard disk" filled with files on everyone, but more of a compassionate heart that wants to help them "erase" evil.
Francis encouraged them to continue "to be dreamers (who) believe in a new humanity, one that rejects hatred between peoples, one that refuses to see borders as barriers".
The trip has been marked by heavy security, including metal detectors and sniffer dogs at most events.
During an unscheduled stop in a Krakow church on Saturday night, Francis condemned the "devastating wave of terrorism" and war that has hit the world.
When he started the trip on Wednesday, Francis said the killing of an elderly priest in France by suspected Islamist militants and a string of other attacks were proof the "world is at war" but that it was not caused by religion.
He announced that the next World Youth Day would take place in Panama in 2019.
(Reporting By Philip Pullella; Editing by Raissa Kasolowsky)