Urging young Catholics to spread the gospel as he ended a trip aimed at re-energizing his flock, Pope Francis celebrated a farewell mass before three million pilgrims on a Brazilian beach.
Latin America's first pontiff was given a rock star welcome on Rio de Janeiro's Copacabana beach, with the faithful waving flags, dancing and chanting "long live the pope!" in a Carnival-like atmosphere.
The head of the world's 1.2 billion Roman Catholics hammered home his plea for young believers to "go and make disciples of all nations" during a trip aimed at stirring passion in a faith losing followers in nations like Brazil.
"Do not be afraid to go and to bring Christ into every area of life, to the fringes of society, even to those who seem farthest away, most indifferent," the 76-year-old Argentine said as dozens of people took a dip in the ocean.
The mass included usual Bible readings but also a rousing concert with a band and choir that could have been seen in one of Brazil's many and expanding Evangelical churches that have lured Catholics.
The crowd estimate provided by the Vatican and organizers of World Youth Day, a gathering of young Catholics, was more than twice the number of people who attended a free Rolling Stones concert in 2006.
The pope announced that Krakow, Poland, the native land of late pope John Paul II, who started the World Youth Day tradition, will host the next gathering in 2016, prompting Polish pilgrims to jump up and down on the beach.
"World Youth Day was fantastic. Everybody is united in God's path. Now the pope leaves and we have to evangelize," said Andressa Pusak, 25, of Brazil.
Francis, who flies back to Rome in the evening, arrived by helicopter and then cruised by the crowd in an open-sided popemobile that took him to the giant stage.
He waved at the adoring throng, kissed babies and sipped mate from his native country handed to him by a pilgrim. A "flash mob" then performed a dance before the mass.
Presidents Dilma Rousseff of Brazil, Cristina Kirchner of Argentina and Evo Morales of Bolivia were on hand for mass.
During his trip, the pope urged his young flock to shake up their congregations and spread the gospel. He exhorted fellow clergymen to get out of their parishes and meet the faithful face-to-face, especially in the slums.
On Saturday, he delved into political and social troubles in Brazil and elsewhere, voicing support for young protesters pressing for change.
"The young people in the street are the ones who want to be actors of change. Please don't let others be actors of change," he said, adding that they should use a "Christian response" to social and political concerns.
After Brazil was rocked by massive protests last month demanding better public services and an end to corruption, the pope urged the country's elite to confront social turmoil with "constructive dialogue."
The pope turned to family issues on Sunday in his first interview since he succeeded retired pope Benedict XVI, telling Cathedral Radio that family was "important, necessary for the survival of humanity."
During the night, young believers who dipped their feet in the water, danced or sang "hallelujah" to samba beats, while others attempted to sleep amid the ruckus.
In a beach usually associated with skimpy bikinis and caipirinha cocktails, nuns, priests and monks mingled with young pilgrims who came from as far as Australia, the Philippines and the United States.
The pope's charisma and desire to shake hands with his flock turned him into a star since he landed in Brazil on Monday.
"He's a man of the people. He has left behind all that pompous stuff of the Vatican," said Angela Collins, a 31-year-old Australian teacher as 45 people from her Brisbane group slept in sleeping bags around her.
The pilgrims used their time on the beach to mingle with people from around the world and discuss the pope's call to shake up the Church. But some succumbed to the temptation of caipirinhas served in beach bars.
"We've had to stand in long lines all week and we're all tired, but despite the little sleep we've had, we're all happy," said Victor Marques, a 29-year-old consultant from Argentina enjoying the lime and cachaca drink with a group of friends.