A judge investigated by cops after sexual misconduct allegations has been allowed to continue in post.
However, he may face a second tribuna l after a hearing failed to examine allegations from two other women.
Sheriff Jack Brown was alleged to have behaved inappropriately towards a female lawyer, known as X, in a courtroom in Aberdeen in 2018, two years after he was appointed.
In January 2019 he was arrested and charged in relation to the allegations, but prosecutors dropped the case three months later.
During the police probe, a further two complainers, known as C1 and C2, also gave statements.
One woman claimed the sheriff put his hand down her bra and another claimed that he had kissed her in a courtroom and touched her bottom.
During a fitness to practice tribunal X alleged inappropriate and unwelcome physical contact towards her, including a claim that he touched her bottom - but failed to examine the statements of the other two women.
However, the tribunal upheld just one allegation that Mr Brown had hugged her and made a remark towards her, as it was said that the other allegations had not been established on the balance of probabilities.
The hearing found that he had acted "entirely inappropriately" and had "failed to respect proper professional boundaries", but did not meet the test to justify removing him from office.
The woman, known as X, went on to seek a judicial review of the decision at the Court of Session and has now won her case.
The finding was overturned as the evidence of two other women was not presented, and a new tribunal may be brought.
Lord Woolman quashed the decision and suggested that a new fitness for office tribunal be convened, but it will be up to the Lord President and First Minister Nicola Sturgeon to decide how to proceed.
In a judgment, published on Tuesday, Lord Woolman said that "X did not receive a 'fair crack of the whip'".
He added: "The tribunal proceeded in ignorance of the availability of other evidence.
"That fact is not contentious. X and her advisers were not responsible for the mistake.
"It did have an impact on the reasoning.
"Accordingly I shall quash the tribunal's decision."
Lord Woolman added: "There is a real possibility that the allegations of C1 and C2 might have altered the decision on the merits."