ROME — Pope Francis paid an impromptu visit to a Rome shantytown Sunday, drawing a boisterous welcome from the community there, while on his way to celebrate Mass at a parish on the outskirts of town.

Knowing that most of the inhabitants of the small settlement, called “Camp Rainbow,” are from Latin America, the pope greeted them in Spanish, shook their hands, and joked with the father of a small baby, saying, “He eats well, eh?”

After greeting each of the residents for more than 10 minutes, Francis led them in the “Our Father” prayer and blessed them.

He then told them he had to head to the parish he was supposed to visit, but not before saying, “Pray for me.”

While he was the archbishop of Buenos Aires, then-Cardinal Jorge Mario Bergoglio spent many days visiting the slums scattered around the outskirts of Argentina’s capital city.

Sunday’s unscheduled visit to the shantytown, where houses are made of bricks and corrugated metal, came as Francis was headed to the parish of St. Michael the Archangel in the eastern Rome district of Pietralata, to hear confessions from five parishioners and to celebrate Mass.

Upon arriving at the parish, the pontiff met a group of homeless people tended to by the Sant’Egidio community.

“The fact that people do not know your name, and call you ‘homeless,’ is something you carry, it’s your cross, and your patience,” Pope Francis said to them. “But there is something in the heart of all of you. Of this, please, be assured: There is the Holy Spirit.”

Addressing a group of parents whose children had been baptized in 2014, he asked them to teach them the faith.

“There are Christian children who cannot make the sign of the cross,” Francis said.

In his meeting with older children, many of whom were Boy Scouts, Pope Francis pointed out that violent conflicts that kill children in Iraq, Ukraine, and Africa are not the only kind of wars.

“Wars come about much earlier in people who do not possess God,” Francis said.

“Where do you want to be? In peace. So why do you quarrel among you?” Francis asked the crowd. “If in your heart you’re jealous of others, war is beginning there.”

Jealousy, Francis said, is something that comes from the devil, the father of all wars, hatred, and lies.

“The devil makes you look for something that is not yours, it all starts with envy, jealousy. A country wants to take over another, so they make a war, killing many people, forcing others to flee or to live on the street. In the world, there are so many wars because there’s hatred,” the pope said.

“And who spreads hatred? The devil.”

During his off-the-cuff homily, Pope Francis once again encouraged the faithful to remain in “daily contact” with Christ, which they can do by carrying a small copy of the Gospel with them to read throughout the day.