VATICAN CITY (Reuters) - Pope Francis strongly defended immigrants at his Christmas Eve Mass on Sunday, comparing them to Mary and Joseph finding no place to stay in Bethlehem and saying faith demands that foreigners be welcomed.

Francis, celebrating his fifth Christmas as leader of the world’s 1.2 billion Roman Catholics, led a solemn Mass for about 10,000 people in St. Peter’s Basilica while many others followed the service from the square outside.

Security was stepped up, with participants checked as they approached St. Peter’s Square even before going through metal detectors to enter the basilica. The square had been cleared out hours earlier so security procedures could be put in place.

The Gospel reading at the Mass in Christendom’s largest church recounted the Biblical story of how Mary and Joseph had to travel from Nazareth to Bethlehem to be registered for a census ordered by Roman Emperor Caesar Augustus.

“So many other footsteps are hidden in the footsteps of Joseph and Mary. We see the tracks of entire families forced to set out in our own day. We see the tracks of millions of persons who do not choose to go away, but driven from their land, leave behind their dear ones,” Francis said.

Even the shepherds who the Bible says were the first to see the child Jesus were “forced to live on the edges of society” and considered dirty, smelly foreigners, he said. “Everything about them generated mistrust. They were men and women to be kept at a distance, to be feared.”

“NEW SOCIAL IMAGINATION”

Slideshow ( 14 images )

Wearing white vestments in the flower-bedecked church, Francis called for a “new social imagination ... in which none have to feel that there is no room for them on this earth.”

The 81-year-old pope, who was born of Italian immigrant stock in Argentina, has made defense of migrants a major plank of his papacy, often putting him at odds with politicians.

Austria’s new chancellor, Sebastian Kurz, has aligned himself with central European neighbors like Hungary and the Czech Republic in opposing German-backed proposals to distribute asylum seekers around EU member states.

In elections in Germany in September, the far-right and anti-immigrant Alternative for Germany (AfD) party made significant gains, with electors punishing Chancellor Angela Merkel for her open-door policy and pushing migration policy to the top of the agenda in talks to form a coalition government.

Italy’s anti-immigrant Northern League, whose leader Matteo Salvini often gives fiery speeches against migrants, is expected to make gains in national elections next year. A law that would give citizenship to children born in Italy to migrant parents is stalled in parliament.

In his homily, Francis said, “Our document of citizenship” comes from God, making respect of migrants an integral part of Christianity.

Slideshow ( 14 images )

“This is the joy that we tonight are called to share, to celebrate and to proclaim. The joy with which God, in his infinite mercy, has embraced us pagans, sinners and foreigners, and demands that we do the same,” Francis said.

Francis also condemned human traffickers who make money off desperate migrants as the “Herods of today” with blood on their hands, a reference to the Biblical story of the king who ordered the killing of all newborn male children near Bethlehem because he feared Jesus would one day displace him.

More than 14,000 people have died trying to make the perilous crossing of the Mediterranean to Europe in the past four years.

On Christmas Day, Francis will deliver his twice-yearly “Urbi et Orbi” (To the City and to the World) blessing and message from the central balcony of St. Peter’s Basilica.

(In fourth paragraph, this story corrects to say Mary and Joseph, not Mary and Jesus.)