ARTICLE AD BOX
Pope Francis has urged Hungarians to "open doors" to migrants, ending his visit to the country led by a nationalist anti-immigration cabinet.
Speaking at an open-air mass in the capital Budapest, the pontiff said it was "sad and painful" to see doors closed to people who were "unlike us".
Up to 100,000 people attended the mass, including Prime Minister Viktor Orban.
Mr Orban has criticised migration, building a barbed-wire border fence to stop migrants crossing into Hungary.
Addressing the crowd near the Hungarian parliament building on Sunday, Pope Francis pleaded to everyone - including "those with political and social responsibilities" - to be more open.
He was speaking about "the closed doors of our selfishness with regard to others... the doors we close towards those who are foreign or unlike us, towards migrants or the poor".
During the mass, the Argentinian pontiff, 86, also referred to Russia's full-scale invasion of Ukraine launched more than a year ago.
He prayed for the "beleaguered Ukrainian people and the Russian people" and for "a future of hope, not war".
The three-day visit was Pope Francis' first trip to Hungary since he became Pope 10 years ago.
What kept him away was the tough anti-migrant stance of Mr Orban, in contrast to his own compassion for all refugees, says the BBC's Nick Thorpe in Budapest.
What brought him to the country, besides his support for Catholics, was the war in Ukraine, our correspondent adds.
Hungary and Ukraine share a 134km (85-mile) border.
Unlike other leaders of the European Union, Mr Orban has refused to back military aid for Ukraine and maintained relations with Russian President Vladimir Putin.
During the carefully calibrated visit to Hungary, the Pope met people of all spheres of society, including youths, the poor, politicians and academics, our correspondent says.