The Scottish government acted unlawfully while investigating sexual harassment claims against Alex Salmond, a judge has ruled.
Allegations against the former first minister, which he denies, were made to the Scottish government a year ago.
The government has now admitted it breached its own guidelines by appointing an investigating officer who had “prior involvement” in the case.
As a result, it conceded defeat in its legal fight with Mr Salmond.
Mr Salmond’s case focused entirely on the fairness of the government’s procedures and will have no bearing on a separate police inquiry into the allegations, which is still ongoing.
‘Sad it was necessary’
Speaking outside the Court of Session in Edinburgh, Mr Salmond said: “The last time I was in that court was to be sworn in as first minister of Scotland. I never thought it possible that at any point I would be taking the Scottish government to court.
“Therefore while I am glad about the victory which has been achieved today, I am sad that it was necessary to take this action.”
He also repeated his calls for the Scottish government’s most senior civil servant, Leslie Evans, to consider her position.
And he thanked the 4,000 people who contributed more than £100,000 to a crowdfunding appeal to help pay for his legal challenge to the government’s handling of the case.
With the government now agreeing to pay his legal costs the money will go to good causes in Scotland and elsewhere, he said.
The government’s admission that it had not followed the correct procedures came during a hearing at the Court of Session on Tuesday morning.
Judge Lord Pentland subsequently ruled that the government’s actions had been “unlawful in respect that they were procedurally unfair” and had been “tainted with apparent bias”.
The Scottish government’s admission centred on an official it appointed to investigate the complaints against Mr Salmond, which were made by two women.
Its lawyer, Roddy Dunlop QC, told the court that the investigating officer was a “dedicated HR professional” who acted in good faith, but did have some contact with the complainers before being appointed to the case.
Mr Dunlop said the investigating officer’s prior contact with the complainers had led the government to accept that there had been a “failure” in one aspect of the investigation, which could have given the impression that they were not acting impartially.
But he said the government did not accept a claim by Mr Salmond’s legal team that the investigating officer had effectively been “assisting the complainers” and “giving them encouragement”.
He also said there was “no question of an individual being held up as a sacrifice”, and that the government had a “duty to investigate the serious complaints” that had been made.
Speaking after the case was resolved, Ms Evans – the Scottish government’s permanent secretary – said she wanted to “apologise to all involved for the failure in the proper application of this one particular part of the procedure”.
But she insisted: “There is nothing to suggest that the investigating officer did not conduct their duties in an impartial way.
“Unfortunately, the interactions with the complainants in advance of the complaints being made meant that the process was flawed, however impartially and fairly the investigating officer conducted the investigation.”
Ms Evans stressed that it was “right and proper that these complaints were investigated”, and that the “procedural flaw in the investigation does not have implications, one way or the other, for the substance of the complaints or the credibility of the complainers”.
And she said it was open to the Scottish government to re-investigate the complaints, adding that “subject to the views of the complainants, it would be our intention to consider this”.
But Ms Evans said this would “only be once ongoing police inquiries have concluded”.
A four-day hearing on the case had been due to begin at the Court of Session in Edinburgh next week, but that will now not go ahead.
The allegations against Mr Salmond date back to 2013, when he was still first minister. He has described the claims as “patently ridiculous”.
The former MSP and MP, who lost his Westminster seat in the 2017 general election, resigned from the SNP in August.