Pope Francis speaks during his visit to St. Francis of Assisi Hospital in Rio de Janeiro, Brazil, on July 24. / Luca Zennaro, AFP/Getty Images

by David Agren, Special for USA TODAY

by David Agren, Special for USA TODAY

RIO DE JANEIRO - Hundreds of thousands of Roman Catholics packed Rio's Copacabana Beach on an unseasonably cool and stormy night for an encounter with Pope Francis, who again implored the masses to turn toward faith instead of materialism, a recurring theme of his week-long visit to Brazil for World Youth Day.

"Possessions, money and monetary power can give a momentary thrill, the illusion of being happy, but they end up possessing us and making us always want to have more," Francis told the crowd.

He added that his followers' persistence and presence in wet and windy weather was proof that "faith is stronger than rain and cold."

The ceremony with the pope opened World Youth Day, a biannual gathering of young Catholics - but an event in which Francis also has been outlining his agenda for the church and his priority of putting the poor first.

Pope Francis once again showed that earlier in the day by venturing into the shanties of Rio to spread a message of solidarity with the poor.

"To the Brazilian people, especially the most humble among you, you can offer the world a valuable lesson in solidarity, a word that is too often forgotten or silenced, because it is too uncomfortable," Francis said to a crowd gathered on a soggy soccer pitch in the Varginha neighborhood.

"No one can remain insensitive to the inequalities that persist in the world," the pope continued. "The culture of selfishness and individualism that often prevails in our society is not what builds ... a more habitable world. It is a culture of solidarity that does."

Francis met cheering crowds and hugged and kissed residents before blessing the altar at a tiny church that serves the community. He prayed before a replica of Brazil's patron saint, the Virgin of Aparecida, and met with a family in their squat yellow home.

"He gave each of us a rosary, he took photos with everyone and embraced each one," said Diego Rodrigues, a 26-year-old friend of the da Penha family who received the papal visit. "I think everyone but the pope was speechless!"

The favela visit comes after Francis on Wednesday focused remarks on disadvantaged people, shunning materialism and standing up to government corruption. He also took on the powerful drug cartels of Latin America, condemning them as "merchants of death."

Favelas are informal developments often cut off from city services, and they are an example of the wide inequalities in Brazil. They are filled with impoverished people from the provinces who come to the richer cities in search of economic opportunities.

"No amount of peace-building will be able to last, nor will harmony and happiness be attained in a society that ignores, pushes to the margins or excludes a part of itself," Francis said.

Security was tight for the visit: Elite police units patrolled as five helicopters circled over an area that only recently was pacified and was so violent in the past that locals called its main street "The Gaza Strip." Locals expressed gratitude for the visit.

"I'm very happy that he's here. I never thought that he would choose such a forgotten place," Vivian de Silva said.

"He seems like a kind, humble person who will speak to anyone," said Raquel Soares, another favela resident.

The pope was known in Argentina for walking the streets of the shanties of Buenos Aires to visit residents. He made sending priests there to live with the local population a priority.

"He used to come celebrate our patron saint ... visit people in their homes," said Hugo Portillo, 20, an Argentine participant in World Youth Day, the week-long event for Catholics worldwide that is being held this year in Brazil.

In favelas, many people have joined Evangelical Christian congregations, such as Pentecostal denominations. De Silva suspects it happened in part because the local parish closed for several years in the 1990s. Only 45% of Rio remains Catholic, making it the least Catholic state in what still is the world's largest Catholic country.

"Pentecostalism started with the dirt poor" and preaches a prosperity Gospel, says Andrew Chesnut, religious studies professor at Virginia Commonwealth University. "People converted to Pentecostal churches at the time of a health crisis because Pentecostalism was really big at preaching: Accept Jesus and you will be cured of all your earthly afflictions, which are poverty-related for most folk."

Many favelas have been becoming less poor, reflecting the economic expansion of the last decade in Brazil that pulled millions into the middle class. A few favelas have started going upscale and attract tourists â?? largely the result of a real estate boom brought about by a pacification process targeting Rio's more than 600 favelas in advance of the 2014 World Cup and 2016 Olympics.

Location helps, too: some favelas in the South Zone offer beautiful views of the ocean and cityscape.

Francis on Thursday told residents not to be discouraged in the face of corruption by their leaders. His words were an apparent reference to violent protests in Brazil in recent weeks by people angry over government corruption and overspending on preparations for the World Cup and the Olympics.

"Never yield to discouragement. Do not lose trust. Do not allow your hope to be extinguished," he said of people facing corrupt governments. "Situations can change, people can change."

His visit Thursday to a favela reflects a papacy that will have a special focus on the poor and a push to have priests provide more pastoral attention to them, Catholic clerics say.

"He put (peripheral places) at the center of his work," adds di Paola, one of 22 priests assigned to live and work the shanties by Francis. "It doesn't surprise me that as pope he would show special attention to them."