Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

VATICAN CITY — Men with deep-rooted homosexual tendencies should not be admitted to the Catholic clergy, and priests who are gay should be celibate or leave rather than lead a double life, Pope Francis said in a new book.

Francis made the comments in a book-length interview with Spanish priest Fernando Prado called “The Strength of Vocation,” in which he discusses the challenges of being a priest or nun today.

The pope said in the book that homosexuality in the Church “is something that worries me." It is due to be published this week in several languages. An advance copy of the Spanish version was provided to NBC News by a Vatican spokesperson and the Italian version was made available to Reuters. The Vatican did not comment on the content of the book.

“The question of homosexuality is a very serious one,” he said, adding that those entrusted with training men to be priests must be certain that candidates are “humanly and emotionally mature” before they can be ordained.

"In our societies, it even seems homosexuality is fashionable. And this mentality, in some way, also influences the life of the church," Francis was quoted as telling his interviewer.

Francis is quoted in the book as commenting on a clergyman who had told him that having gays in Catholic religious housing "isn't so grave" because it's "only an expression of affection."

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

That reasoning "is in error," Francis said. "In consecrated life and priestly life, there is no room for this kind of affection."

“For this reason, the Church urges that persons with this rooted tendency not be accepted into (priestly) ministry or consecrated life,” he said.

He urged homosexuals who are already priests or nuns to be celibate and responsible to avoid creating scandal. “It is better that they leave the priesthood or the consecrated life rather than live a double life,” he said. The pope has warned Italian bishops in the past to vet seminarians closely and reject those they suspect might be gay.

Still, Francis, as he has in the past, stressed that gay Catholics contribute to the life of the church. He said the church must always remember that "they are persons who will live in the service of the church, of the Christian community, of the people of God. Let's never forget this perspective."

Francis in his papacy has sought to stress that while obeying church teachings, the faithful must also be compassionate and open to others with different views.

Catholic teaching considers homosexual activity sinful, and that everyone, except married heterosexual couples, should abstain from sex.

The mid-August interview with Francis was conducted less than two weeks before Archbishop Carlo Maria Vigano, the Vatican’s former ambassador to the Vatican, threw the Church into turmoil with a bombshell statement against the pope and Vatican officials on Aug. 26.

Vigano said a “homosexual network” existed in the Vatican, whose members helped promote each other’s careers in the Church.

He also accused the pope of having ignored alleged sexual misconduct with adult male seminarians by former American cardinal Theodore McCarrick, 88.

The Vatican said Vigano’s accusations were riddled with “calumny and defamation.”

The Catholic Church has been haunted for more than two decades by evidence of thousands of cases of sexual abuse of minors by clergy around the world, in countries ranging from the United States to Australia, Ireland, Belgium, Germany and Chile.

In July, McCarrick became the first cardinal to resign in nearly 100 years after U.S. Church officials said allegations made in a separate investigation that he had sexually abused a 16-year-old boy almost 50 years ago were credible and substantiated.

McCarrick has said he had no recollection of the alleged abuse of the minor, but has not commented on the allegations of misconduct with the seminarians, which allegedly took place decades ago.