ROME (AP) — Pope Francis has clarified his recent comments about homosexuality and sin, saying he was merely referring to official Catholic moral teaching that teaches that any sexual act outside of marriage is a sin.

And in a note Friday, Francis recalled that even that black-and-white teaching is subject to circumstances that might eliminate the sin altogether.

Francis first made the comments in an interview Jan. 24 with The Associated Press, in which he declared that laws criminalizing homosexuality were “unjust” and that “being homosexual is not a crime.”

As he often does, Francis then imagined a conversation with someone who raised the matter of the church’s official teaching, which states that homosexual acts are sinful, or “intrinsically disordered.”

“Fine, but first let’s distinguish between a sin and a crime,” Francis said in the pretend conversation. “It’s also a sin to lack charity with one another.”

His comments calling for the decriminalization of homosexuality were hailed by LGBTQ advocates as a milestone that would help end harassment and violence against LGBTQ persons. But his reference to “sin” raised questions about whether he believed that merely being gay was itself a sin.

The Rev. James Martin, an American Jesuit who runs the U.S.-based Outreach ministry for LGBTQ Catholics, asked Francis for clarification and printed the pope’s handwritten response on the Outreach website late Friday.

In his note, Francis reaffirmed that homosexuality “is not a crime,” and said he spoke out “in order to stress that criminalization is neither good nor just.”

“When I said it is a sin, I was simply referring to Catholic moral teaching, which says that every sexual act outside of marriage is a sin,” Francis wrote in Spanish, underlining the final phrase.

But in a nod to his case-by-case approach to pastoral ministry, Francis noted that even that teaching is subject to consideration of the circumstances, “which may decrease or eliminate fault.”

He acknowledged he could have been clearer in his comments to the AP. But he said he was using “natural and conversational language” in the interview that didn’t call for precise definitions.

“As you can see, I was repeating something in general. I should have said: ‘It is a sin, as is any sexual act outside of marriage.’ This is to speak of ‘the matter’ of sin, but we know well that Catholic morality not only takes into consideration the matter, but also evaluates freedom and intention; and this, for every kind of sin,” he said.

Some 67 countries or jurisdictions worldwide criminalize consensual same-sex sexual activity, 11 of which can or do impose the death penalty, according to The Human Dignity Trust, which works to end such laws. Experts say even where the laws are not enforced, they contribute to harassment, stigmatization and violence against LGBTQ people.

Catholic teaching forbids gay marriage, holding that the sacrament of marriage is a lifelong bond between a man and a woman. It reserves intercourse for married couples while forbidding artificial contraception.

In his decade-long pontificate, Francis has upheld that teaching but has made outreach to LGBTQ people a priority. He has stressed a more merciful approach to applying church doctrine, to accompany people rather than judge them.