Pope Francis also paid a lightning visit to Prime Minister Viktor Orbán during his short visit to Hungary.
The meeting took place behind closed doors in a museum in Budapest.
The visit is not self-evident, because the Pope and Orbán are not on the same page.
The Pope has criticized countries with nationalist and populist politics on several occasions, including Hungary.
He calls for support for people of different religions who are fleeing war and poverty.
This is at odds with Orbán's harsh anti-migration policy.
The Pope's visit is short-lived and is not an official papal visit.
The head of the Catholic Church is in Budapest to conclude a religious convention.
According to a pro-Orban television channel, the short duration of the visit is a way of "humiliating" the prime minister.
After Hungary, the Pope will travel to Slovakia, where he will stay for two days.
The meeting was not broadcast and no photo opportunity was held.
Orbán shared a photo on Facebook in which he shakes the Pope's hand.
"I asked Pope Francis not to let Christian Hungary perish," the caption reads.
During the mass, the Pope called on Hungarians to be open. He said the country can maintain its Christian roots while opening up to and considering those who need help, a statement not in line with Prime Minister Viktor Orbán's views. The mass in central Budapest was attended by tens of thousands of faithful.Keywords: