A prominent gay cleric's homosexuality was the only reason he was blocked from becoming a bishop, he has claimed.
Canon Jeffrey John was favourite to be Bishop of Llandaff but was subject to 'a number of homophobic remarks' during the appointment process before being eventually rejected by bishops, he said.
In an unusual move, Dr John, who is currently Dean of St Albans Cathedral, wrote an open letter to the senior Bishop of Swansea and Brecon, John Davies, complaining at his treatment which he said was a 'clear and ludicrous breach of process'.
The Church in Wales strongly denied the allegations of homophobia.
Referring to the initial decision process he said: 'In the course of discussion a number of homophobic remarks were made and were left unchecked and unreprimanded by the chair.
'Much more importantly, the only arguments adduced against my appointment – in particular by two of the bishops - were directly related to my homosexuality and/or civil partnership – namely that my appointment would bring unwelcome and unsettling publicity to the diocese, and that it might create difficulties for the future Archbishop in relation to the Anglican Communion.'
He added one bishops told him these issues caused by his sexuality 'were the only objections adduced' and the sole reason he was blocked from the promotion.
'The injustice of the arguments about publicity and the Anglican Communion was pointed out to you several times in the college by the Llandaff electors and by others. This is precisely the way that anti-gay discrimination always works,' he wrote.
Dr John was strongly supported by locals in the area and won more than half of the votes in the initial election body, Christian Today revealed. But his sexuality and long-term civil partnership to fellow Anglican priest Grant Holmes meant he was barred by a handful of opponents meaning he failed to secure the two-thirds necessary.
The decision was then passed to senior bishops in the Church in Wales who asked for views across dioceses. Dr John said despite local church leaders being 'unanimous' in support and hundreds writing to back him, the bishops ignored their views and barred his name from the new shortlist.
'To ride roughshod of the very clearly expressed, unanimous view of a diocese in this way is extraordinary, unprecedented and foolish,' he told Bishop Davies.
'You decided, arbitrarily, to ignore the submissions that you had asked for, and to declare that those who were discussed at the Electoral College were now, in fact, no longer to be considered. This is a clear and ludicrous breach of process, and a further insult to the people of the diocese, and very many others who took the trouble to contribute their view.
'I trust there will now be an open and honest examination of this process in the light of day, and that you will not attempt to appoint a bishop for Llandaff until it is complete.'
The strongly worded letter is rare as the election for bishop is typically a highly secretive process.
This is not the first time Dr John has been barred from promotion. He was previously nominated to be Bishop of Reading in 2003 but was forced to withdraw himself under intense pressure from traditionalists.
He was later in the running for Bishop of Bangor in 2008 and then again for Bishop of Southwark in 2010 but was both times turned down with conservatives threatening a split in the Church.
But the latest rejection to be Bishop of Llandaff is particularly striking because of the strong support he received among local clergy and parishioners in the largely liberal diocese.
A Church in Wales spokeswoman told Christian Today: 'At the recent meeting of Electoral College no one candidate secured the necessary two-thirds majority to be elected Bishop of Llandaff.
'The appointment will now be made by the Church's bishops. After a process of consultation they have drawn up a shortlist of names which is confidential. However, the Bishops strongly deny allegations of homophobia.'
The spokeswoman added that neither homosexuality nor participation in a civil partnership were a bar to any candidate being either nominated or elected as Bishop of Llandaff.