The moderator of the General Assembly of the Church of Scotland used part of his Christmas sermon to accuse the kirk of reinforcing hatred of gay people.
The moderator says gay people face a "homophobic mindset"
He told a congregation in Aberdeen that the church and the rest of Scotland must shake off its homophobia.
"These are spiritual matters because hatred may only be cured by a change of heart," according to the Right Rev Professor Iain Torrance.
The moderator has said he would not be opposed to openly gay ministers.
In his sermon at St Machar's Cathedral, Prof Torrance said that in 2001-2002, there was a 200% increase in cases of syphillis among those having gay sex but that sufferers were still too afraid to seek help.
"That fear in turn testifies to a persistent homophobia in society at large.
"It is almost 2004 but gay young people in Scotland are four times more likely than others to report a serious suicide attempt," his sermon continued.
"We all require a change of heart because the church not least has contributed to the prevailing homophobic mindset."
On the day that the murdered teenager Jodie Jones was buried, the church's press office received 38 calls in 10 minutes on the moderator's views on gay ministers.
"Which was the event of greater importance," he asked. "How may we be set free from such compulsive and consuming obsession?"
Prof Torrance also welcomed the Scottish Executive's proposed Anti-social Behaviour Bill as a "brave and relevant programme".
"A parliament which is willing to address Scottish issues with Scottish legislation is much to be welcomed.
"But there is a limit to what can be done by legislation.
"No number of acceptable behaviour contracts can assuage the self-hatred, loss of confidence and despair which is at the heart of the issue."