Nicola Sturgeon has said she had no reason to want to "get" Alex Salmond as she dismissed claims of a plot against him as "absurd".
The first minister said her government made a “dreadful, catastrophic mistake” during its inquiry into two sexual harassment complaints against Salmond by appointing an official who had previously spoken to the complainers as its investigation officer.
She apologised to the two women who had made the complaints, saying they were let down by a "very serious error".
But she rejected much of Mr Salmond's version of events.
Closely questioned by MSPs during a marathon eight-hour evidence session at the Scottish parliament, Sturgeon insisted her former mentor was wrong to accuse her, the Scottish National party or her officials of a vendetta or conspiracy against him.
She said she had watched Mr Salmond give evidence to the inquiry committee last Friday and had found herself "searching for any sign at all that he recognised how difficult this had been for others too".
“I must rebut the absurd suggestion that anyone acted with malice or as part of a plot against Alex Salmond,” she said in her opening statement.
Ms Sturgeon acknowledged that Mr Salmond had been cleared of all of the sexual assault allegations against him by a High Court jury.
But she added: "I know just from what he told me that his behaviour was not always appropriate.
"And yet across six hours of testimony, there was not a single word of regret, reflection or even a simple acknowledgement of that.
"I can only hope that in private, the reality might be different."
The first minister said the female complainers had come forward "of their own free will", and that while some offered support to each other, this was not evidence of a conspiracy.
Sturgeon came under pressure from MSPs to explain why there had been repeated delays in the release of the government’s legal advice, and key internal documents, as she offered new explanations about why she had met Salmond while the harassment inquiry was under way.
Jackie Baillie, of Labour, alleged Sturgeon and Salmond had breached the confidentiality of complainers when he discussed their allegations against him in a meeting at her home on 2 April 2018, yet Sturgeon waited until early July before telling Leslie Evans, the permanent secretary, they had met.
Sturgeon acknowledged she discussed Salmond’s criticisms of the inquiry with him five times partly because she felt loyalty towards him, but delayed telling Evans because she feared that would be seen as her interfering in the process.
Labour and Conservative MSPs accused Sturgeon’s deputy first minister, John Swinney, of breaking the government’s promises to publish all its legal advice, despite his last-minute decision to release previously secret legal papers late on Tuesday afternoon.
Sturgeon was also pressed on whether she had investigated allegations that a senior government official had leaked the name of a complainer to Geoff Aberdein, Salmond’s former chief of staff, before Sturgeon met Aberdein in her office at Holyrood in late March 2018.
Aberdein’s account was supported by Salmond’s lawyer Duncan Hamilton and his former spokesman Kevin Pringle, who told the committee on Tuesday Aberdein had made that claim in a conference call with him soon after he met that official.
The Tory MSP Murdo Fraser said that was “an incredibly serious issue” and potentially unlawful. Sturgeon said Aberdein’s account had been denied by the official concerned but she said the allegation was included in an investigation by James Hamilton, Ireland’s former director of public prosecutions, into whether Sturgeon had broken the ministerial code.
“That was not the way, as I understand it, that happened, in the way that is being set out,” she said.
During a series of tense exchanges, Sturgeon said she had no idea who leaked news that the internal inquiry had upheld the complaints against Salmond to the Record newspaper in August 2018, despite his allegations a government figure must be to blame.
The first minister also insisted that the complaints procedure was not put in place to target Mr Salmond, as some of his supporters have claimed.
She told the committee that she was not aware of any allegations or concerns about sexually inappropriate behaviour on the part of Mr Salmond until a media enquiry from Sky News was made in November 2017.
Ms Sturgeon also insisted that details of the allegations against Mr Salmond that were leaked to the Daily Record newspaper - which broke the story in August 2018 - had not come from her or from anyone acting on her authority or instruction.
Ms Sturgeon finished her evidence by admitting that mistakes had been made - but dismissed suggestions from Mr Salmond that this was because Scotland's leadership and institutions had failed.
Sturgeon said in her final remarks, that what comes out of it, is the message that no matter how powerful you are or were, no matter your status or connections, if you are accused of serious offences they will be investigated and you will have the chance to defend yourself in court. That is how these things should work.
"The idea that because somebody doesn't like what has happened over the last couple of years we allow this attack to be made on the fundamentals of our democracy I find deeply distressing and deeply unfair," she added.