By Philip Pullella

ABOARD THE PAPAL PLANE (Reuters) - Pope Francis said on Sunday that homosexuals and transsexuals should be treated with respect but that teaching gender theory is unacceptable "indoctrination" of young people.

"When a person (who is gay) arrives before Jesus, Jesus certainly will not say, 'Go away because you are homosexual,'" Francis said.

The pope made his comments in the latest wide-ranging and freewheeling conversation with reporters aboard the plane returning from a foreign trip.

The pope, who made headlines on his first trip in 2013 when he uttered his now-famous phrase "Who am I to judge?" about homosexuals, spoke in answer to a question about a comment he made in Georgia about various threats to marriage.

He said that as a priest, bishop and even now pope, he had ministered to people with homosexual tendencies as well as some who were not able to remain chaste, as the Church asks them to be.

"I accompanied them, I brought them closer to the Lord," he said. "Some were not able (to obey Church teachings), but I accompanied them and I never abandoned one of them. That is a fact. People must be accompanied just like Jesus accompanies them."

During his trip to Georgia and Azerbaijan, he told priests and nuns that teaching gender theory in schools was part of a "global war" against marriage.

Gender theory is broadly the concept that while people may be biologically male or female, they have the right to identify themselves as male, female, both or neither.

"What I was talking about was the nastiness that is present today in indoctrinating people in gender theory," he said when asked to elaborate on his earlier comments in Georgia.

"IDEOLOGICAL COLONIZATION"

He said gender theory being taught in schools "is against natural things."

"It is one thing for a person to have this tendency, this option, and even change sex," he said. "But it is another thing to teach it, gender theory, in schools along these lines in order to change mentality. I call this ideological colonization."

The pope has used the phrase "ideological colonization" in

the past to denounce what he says are attempts by rich countries to link development aid to the acceptance of social policies such as allowing gay marriage and contraception.

Francis told the story of a Spanish person he met who told him of how much he had suffered because he felt like a boy in a girl's body. The person later had a sex change operation and married a woman.

The person told Francis in a letter how much the couple suffered when a local priest shouted to them: "You will go to hell." Francis invited them to the Vatican to talk, and the couple were pleased that they were treated with dignity.

"Life is life, and things should be taken as they come," the pope said. "Sin is sin, but tendencies or hormonal imbalances ... can cause many problems and we have to be careful.

"But each case must be welcomed, accompanied, studied, discerned and integrated. This is what Jesus would do today."

He then joked: "Please don't write that the pope will sanctify transsexuals. I can see the front pages of papers now. But no, it is a moral question. It is a human question, and it must be resolved as best as possible, always with the mercy of God, the truth ... always with an open heart."

(Reporting By Philip Pullella; Editing by Lisa Von Ahn)