Pope Francis says gay people should be integrated into society, not marginalized, but that the Roman Catholic Church stands by its teaching that homosexual acts are a sin.
The pope, flying home from a visit to Brazil, also told reporters on his plane that the "door is closed" on the issue of ordaining women priests.
"If someone is gay and he searches for the Lord and has good will, who am I to judge?" the pontiff said during a news conference that lasted nearly an hour and a half.
He said the church still considers homosexual acts to be sinful, but that gays should not be marginalized because of their orientation.
Rather, he said, they should be "integrated into society." However, he deplored "lobbying by this orientation, or lobbies of greedy people, political lobbies, Masonic lobbies, so many lobbies. This is the worse problem."
The pope said women should have a greater role in the Roman Catholic church, but said the Vatican remains firm in its opposition to ordaining women as priests.
He said Pope John Paul rejected the ordination of women "with a formula that was definitive. That door is closed."
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" to help those most in need and 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 Evo Morales of Bolivia.
Pope Francis met later Sunday with Latin American bishops before leaving for Rome, urging them on in their work.
"Many of you came as disciples to this pilgrimage, I have no doubts that all of you now will leave as missionaries."
During his weeklong trip Brazil, the pontiff 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.