Alex Salmond has been accused of mounting a "personal vendetta" against Scotland's most senior civil servant.

The former first minister called for Leslie Evans to quit over the "unlawful"way the Scottish Government dealt with sexual misconduct complaints against him.

Dave Penman, general secretary of the FDA trade union which represents senior civil servants, claimed Mr Salmond had "continually targeted" the Scottish Government Permanent Secretary.

He hit out after the former SNP leader won a procedural case against the Scottish Government over its investigation into sexual harassment allegations brought by two women - with Mr Salmond warning that the ruling at the Court of Session in Edinburgh could leave the taxpayer with a £500,000 bill.

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

HeraldScotland:

The person who investigated the complaints had some involvement with the two women prior to being appointed investigating officer, it emerged.

Mr Penman told BBC Radio Scotland's Good Morning Scotland programme that it had "only come to light late in the day" and was "not necessarily" a resigning matter.

But Mr Salmond repeatedly called for Ms Evans to quit her post, claiming she was responsible for the "institutional failure" in the handling of the complaints.

He demanded: "When she has got some time for mature reflection, I hope that the Permanent Secretary considers her position."

Read more: Nicola Sturgeon and Alex Salmond at war over £500k legal case

Mr Salmond added that on a "day of abject humiliation for the Scottish Government that seems to me like a correct and proper response".

But Mr Penman said: "I think what has been disappointing is the way Alex Salmond has continually targeted Leslie Evans from day one on this case, he's called it the 'Leslie Evans procedure'. Yesterday he made repeated assertions that she should resign.

"He has always portrayed this as a personal vendetta, even going as far as suggesting the Civil Service was acting without ministerial authority, so it was no surprise yesterday that Alex Salmond would therefore call for Leslie Evans' resignation."

He added: "Confidence in the Permanent Secretary is a matter for the First Minister. I'm sure when Alex Salmond was first minister that is what he would have said and I don't think anyone could be in any doubt from what Nicola

Sturgeon said yesterday that Leslie Evans retains the confidence of the First Minister."

Ms Evans took the decision to settle the court case "with my support", Ms Sturgeon said, after it became clear that the investigation had been "flawed" in "one procedural respect".

Read more: Nicola Sturgeon aides due to testify before case collapse

She also made clear that she has not been in contact with her former mentor since July 2018.

Ms Evans has already said an internal review will be carried out into the way the complaints process was handled, as she stressed that the Scottish Government had "acted in good faith at all times".

The Permanent Secretary said: "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."

The Scottish Government could reinvestigate the complaints, but both Ms Evans and Ms Sturgeon have said that will only take place after ongoing police inquiries into the allegations have concluded.