Nicola Sturgeon has insisted she had no reason to want to “get Alex Salmond” as she apologised for a “serious mistake” in the investigation into sexual harassment allegations against him.

In an explosive eight-hour hearing, the First Minister expressed “deep regret” that two women were failed and more than £500,000 of taxpayers’ cash was wasted in the Scottish Government’s botched probe.

But she branded Mr Salmond’s claims of a high-level plot against him as “absurd”.

Ms Sturgeon was hauled before the Committee on the Scottish Government Handling of Harassment Complaints after Mr Salmond used his appearance last week to accuse her of misleading parliament and breaching the ministerial code - which she denies.

She also rejected claims by Mr Salmond’s lawyer that she had offered to intervene.

The First Minister gave evidence to MSPs for nearly eight hours over the handling of complaints of sexual harassment against Alex Salmond

The error in the bungled investigation was that the Investigating Officer had prior contact with the female complainers.

A successful judicial review by Mr Salmond resulted in the investigation being ruled unlawful and “tainted by apparent bias”.

He was later acquitted of 13 charges following a criminal trial.

Ms Sturgeon apologised for the failings, saying: “Although I was not aware of the error at the time I am the head of the Scottish Government so I want to take this opportunity to say sorry to the two women involved and to the wider public.”

But the First Minister rejected the “absurd suggestion that anyone acted with malice or as part of any plot”.

“A number of women made serious complaints about Alex Salmond’s behaviour,” she said.

“As First Minister I refused to follow the age-old pattern of allowing a powerful man to use his status and connection to get what he wants.”

Nicola Sturgeon and Alex Salmond were close allies for many years

Ms Sturgeon said her former ally informed her of “deeply inappropriate behaviour” in a meeting at her home on April 2 2018, which was a “moment in my life that I will never forget”.

She has come under fire for initially claiming that this meeting was the first time she was informed of the complaints, when she later admitted to meeting his former chief of staff Geoff Aberdein on March 29.

She told MSPs Mr Aberdein “did indicate a harassment-type issue had arisen, but my recollection is he did so in general terms”.

Describing the April 2 meeting, she said Mr Salmond denied the complaints but he recounted an incident which “he said he had apologised for at the time”.

The First Minister denied allegations that a senior member of her team had leaked the name of one of the complainers to Mr Aberdein, who passed it to Mr Salmond.

Ms Sturgeon appeared emotional at times as she told MSPs of her long-standing friendship with Mr Salmond, who she said had been “one of the “closest people to me in my entire life”.

She added: “I would never have wanted to ‘get’ Alex Salmond - I would never, ever have wanted any of this to happen.

"I had no motive, intention or desire to ‘get’ Alex Salmond.”

The bitter feud between the pair was partly sparked by her failure to intervene on his behalf, she said.

“I did not intend to intervene, and I did not intervene, and while I know it is more complex than this, I think in terms of his anger towards me I think that is the root of it with Mr Salmond.”

She refused to apologise for his conduct, saying: “I trusted him.

"I am not going to apologise for the behaviour of somebody else.”

As she gave her testimony, Mr Salmond lodged a formal complaint with the head of Scotland’s civil service “on the conduct of the official who is alleged to have breached civil service rules, by disclosing the name of a complainant in the Scottish Government process".