Former first minister Alex Salmond has called on Scotland's top civil servant to quit her post after accusing her of "wasting" hundreds of thousands of pounds of public money defending the administration's "unlawful" handling of sexual misconduct allegations against him.

The former SNP leader took legal action against the Scottish Government that he once led, to contest the complaints process activated against him.

READ MORE: Alex Salmond wins court battle with Scottish Government 

A four-day hearing into the case was due to be held next week at the Court of Session in Edinburgh.

But on Tuesday, Judge Lord Pentland ruled that the Scottish Government's actions were "unlawful in respect that they were procedurally unfair and that they were tainted with apparent bias".

The court had heard the person who investigated the two complaints of sexual misconduct - which Mr Salmond strongly denies - had involvement with the complainers prior to being appointed investigating officer.Outside the court, Mr Salmond said: "I'm obviously glad, delighted, by the result today.

"The government has made an abject surrender in terms of the case."

He claimed Leslie Evans, the Permanent Secretary to the Scottish Government, was responsible for the "institutional failure" in the handling of the complaints, formally lodged in January.

And he warned the case could cost the public purse as much as £500,000.

"Because the process has been agreed as unlawful, as unfair and tainted by apparent bias, then the Scottish Government have had to concede on the case and the expenses to the maximum extent," he said.

READ MORE: Staff contacted as part of ‘Operation Diem’ police probe into Salmond sexual misconduct claims 

"That is going to raise a cost to the public purse of many, many hundreds of thousands of pounds."

Mr Salmond added: "The process has already been admitted as unlawful, unfair and tainted by bias. You couldn't get more tainted.

"So when she has got some time for mature reflection, I hope that the Permanent Secretary considers her position, not events in the future.

"I cannot think on a day of abject humiliation for the Scottish Government that seems to me like a correct and proper response."

The former first minister quit the SNP after bringing the legal challenge, but he said today it was now his intention to rejoin the party he had once led.

He added: "I'm not putting out the bunting today. Yes, I'm glad to have won, I'm really really sad to be forced to take this action against a government I led for almost eight years."

The funding for the case raised through a controversial crowdfunding campaign which hit £100,000 in three days will be donated to good causes, Mr Salmond added.
He said: "I am thankful to the more than 4,000 people who contributed to the crowdfunder for this judicial review, without whose support I would not have been able to defend my position."

He stressed he had always maintained his innocence regarding the allegations and believed an ongoing police investigation would determine this.

Ms Evans said an internal review would be carried out into the way the complaints process had been handled.

And she said she regretted the "distress" caused to the two women who had brought the complaints.

She stated: "The Scottish Government has acted in good faith at all times and will continue to do so. It was right and proper that these complaints were investigated and I stand by the decision to carry out that investigation.

"It is also important to note 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.

"The judicial review was never about the substance of the complaints, but about the process that took place to investigate those complaints."

As a result, 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".
Mr Salmond said this was an "extraordinary and desperate" statement as options for this had been available during the case.
He indicated he is considering further legal action against the Permanent Secretary.