A former Church of Scotland minister has won the right to claim compensation for alleged sex discrimination.
The Law Lords overturned a decision by the Court of Session
Helen Percy said she was forced out of her job after being accused of having an affair with a married church elder.
Law Lords in London ruled she could take the Kirk to a tribunal, despite defence claims that her spiritual job meant she had no employment contract.
The church said the judgement did not deal with the facts of Ms Percy's claim.
Ms Percy, a single woman, was suspended from her post as an associate minister for six glen parishes in the Presbytery of Angus in 1997.
She had always insisted that only one act of sexual intercourse took place during her relationship with the church elder.
The 39-year-old later resigned and took her sex discrimination complaint to an employment tribunal.
She argued that the Kirk did not take similar action against male ministers over extra-marital affairs.
However, the tribunal said it had no jurisdiction to hear her case because her employment was essentially spiritual and not covered by civil law.
An appeal tribunal and the Court of Session in Edinburgh also upheld the Kirk's exclusive jurisdiction over its own affairs and said Ms Percy was not an employee.
In the House of Lords, she sought a ruling that her agreement with the church to work as a minister amounted to a contract of employment.
Her appeal was opposed by the church's Board of National Mission.
Its lawyers argued that, under the 1921 Scotland Act, the Kirk's power to decide all matters of doctrine, worship, government and discipline came from Christ alone.
By a 4-1 majority, five Law Lords in London rejected submissions that a sex discrimination claim was to be regarded as a spiritual matter.
Ms Percy, who was also a part-time chaplain at HM Prison Noranside, intended to bring a compensation claim for lost income, pension and housing benefits, and damages for injuries to her feelings and stress-related illness.
A Church of Scotland spokesman said: "This judgement does not deal with the facts of Ms Percy's claim.
"It is about jurisdiction - that is whether Ms Percy is entitled to have her case heard within the civil courts as opposed to solely within the courts of the church.
"Based on a legal interpretation of Ms Percy's particular contract, the House of Lords has ruled that Ms Percy's sex discrimination claim can be tested in a civil court.
"This judgement would not apply to other categories of ministers of religion.
"Because Ms Percy's case has been referred back to the employment tribunal, it would be inappropriate for us to make any further comment at this time."