Pope Francis ended his trip to Brazil with a Mass on the world famous Copacabana beach.
An estimated three million people gathered for Sunday's oceanfront service to mark the end of the Catholic Church's World Youth Day festivities.
The Argentine-born pope urged Catholics to go to the 'fringes of society" and continue to spread the message of the Catholic faith.
The Mass, which included Bible readings and a concert, had a festival-like atmosphere with Pope Francis receiving an enthusiastic welcome from people waving flags, singing and dancing.
The service was attended by presidents Dilma Rousseff of Brazil, Christina Kirchner of Argentina and Bolivia's Evo Morales.
Pope Francis met later Sunday with Latin American bishops before leaving for Rome.
During his week-long trip Brazil, the pope urged bishops, priests and other clergy to get out of their churches to spread the gospel. On Thursday, he reached out to the poor himself with a visit to one of Rio's notorious slums, or favelas.
The pope announced that the next World Youth Day would be held in Krakow Poland, the home of the late Pope John Paul II.