A gay clergyman prevented from taking up a post as a hospital chaplain was not discriminated against, an employment tribunal panel has ruled.
In a 58-page judgement, the panel also dismissed a claim of harassment made by Canon Jeremy Pemberton.
It was against the former acting Bishop of Southwell and Nottingham, the Rt Revd Richard Inwood.
Mr Pemberton claimed that the Church of England's stance on same-sex marriage breached the 2010 Equality Act.
It came after his permission to officiate was revoked after marrying his partner in April 2014.
A spokesperson for the Diocese of Southwell and Nottingham said: "We are thankful to the tribunal for its work on this complex case and for its findings in favour of the Rt Revd Richard Inwood, on all the claims made against him.
"Churches across the diocese continue to offer a generous welcome to people from all backgrounds."
Analysis from Caroline Wyatt, BBC religious affairs correspondent
The case has shown the complexities of a Church whose doctrine and Canon law now diverges significantly from secular law in Britain on the issue of same-sex marriage.
At least one other vicar has married his same-sex partner but has not lost his permission to officiate. Each diocese deals with its clergy individually, giving bishops some discretion in how to handle the issue.
The Church of England will be relieved by the ruling, with the tribunal saying its doctrine was clear.
The new Synod, which will convene later this month, is as likely to be consumed by the question of homosexuality as the last Synod was by the issue of women bishops.
Canon Pemberton had been working as a chaplain in a Lincolnshire hospital but said an offer to work in Nottinghamshire was withdrawn after he married his partner in 2014.
The decision not to issue a licence meant he was unable to take up a post as a bereavement manager for the Nottinghamshire-based Sherwood Forest Hospitals NHS Trust.
He had claimed the acting Bishop of Southwell and Nottingham, the Rt Revd Richard Inwood, had discriminated against him because of his sexual orientation.
However, the bishop told the tribunal that same-sex marriage was against the church's beliefs.
The clergyman, who took his claims to a tribunal in Nottingham, expressed disappointment at the tribunal's ruling but thanked those who have supported the legal action.
'Blaze of publicity'
He said: "We are obviously very disappointed. Our lawyers have considered the judgment and are in the process of preparing the Grounds of Appeal for submission to the Employment Appeal Tribunal.
"We would like to thank all of those who have supported us through this litigation process thus far."
During the tribunal hearing, the Church of England argued that Canon Pemberton had gone against its doctrine when he married in "a blaze of publicity".
The clergyman submitted that the church would not have had an issue if he had entered into a civil partnership rather than a marriage.