Pope Francis toured a a Rio shantytown Thursday after receiving the keys to the city and blessing the Olympic flag, before meeting with throngs of young Catholics on Copacabana beach.
Under a pelting rain, the pontiff arrived aboard his white jeep at the Varginha favela, a community of 1,000 people which for decades was under the sway of narco-traffickers until it came under police control less than a year ago.
Earlier, the Argentine-born pontiff, who is on a week-long visit to Brazil, received the keys to the city at a city hall ceremony attended by Mayor Eduardo Paes and state governor Sergio Cabral.
The pontiff blessed hundreds of well-wishers, including many children, gathered in the city hall gardens.
"Good morning to all, Thank you for being here. I bless you all, your families, friends and neighborhoods," said the pope, who also blessed the Olympic flag and shook hands with sport celebrities, including ex-football star Zico.
The pope on Thursday was getting starkly contrasting images of the Marvelous City -- the desolation of its northern slums and the opulence of its posh beach resorts.
In Varginha, the pope was greeted with banners, flags and two two-meter-high statues representing the pontiff and venerated Black Virgin of Aparecida.
The slum is located in an area known as the "Gaza Strip" because of frequent and violent clashes between armed drug gangs and police.
There, the first Latin American pope, who was to meet with a family that lives in the favela, blessed the altar of the tiny Sao Jeromino Emiliani church before addressing around 30,000 people at a nearby soccer field.
Varginha is one of dozens of Rio slums where police have evicted drug gangs and reasserted control ahead of next year's World Cup and the Olympics that will follow two years later.
Its residents are roughly equally divided between Catholics and Evangelical protestants, and both communities have vowed to welcome the pontiff.
Vatican officials, however, have made no secret of the fact that the pope's first trip abroad since election aims to revitalize the eroding Catholic faith, at a time when evangelical churches are gaining strength in Brazil.
On Thursday evening, Pope Francis will be officially welcomed by mammoth crowds of young Catholics attending World Youth Day (WYD) on famous Copacabana beach.
On Tuesday night, more than 500,000 well-wishers flooded the beach for a mass led by Rio Archbishop Orani Tempesta to kick off the event, amid scenes of chaos as the city's transportation system was overwhelmed following a two-hour metro breakdown.
That came a day after crowds of pilgrims were able to stop the pope's convoy and reach their hands inside his car's open window, after the driver made a wrong turn as he made his way into Rio from the airport.
Rio Mayor Eduardo Paes has apologized, and said steps were being taken to avoid a repeat of such "deplorable incidents."
Tight security was in place after the pope met with President Dilma Rousseff at the state government headquarters, where hundreds of demonstrators protested the $53 million spent on organizing the papal visit.
Several people were hurt, including an AFP photographer, when protesters clashed with riot police, who wielded tear gas and water cannons against demonstrators, some of whom who hurled firebombs.