Nicola Sturgeon has insisted she had no reason to want to "get" Alex Salmond as she dismissed claims of a plot against him as "absurd".
The first minister was speaking at the inquiry into her government's unlawful handling of harassment complaints against her predecessor.
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.
And she insisted her government had nothing to hide, despite accusations of a cover-up from opposition parties.
Mr Salmond has previously claimed several people within the SNP and Scottish government - including Ms Sturgeon's husband Peter Murrell, the party's chief executive - were involved in a "deliberate, prolonged, malicious and concerted effort" to damage his reputation, even to the extent of attempting to have him imprisoned.
In her eight hours of evidence to the committee, Ms Sturgeon said she had "thought often" about the impact of the past three years on Mr Salmond, but said he had shown no sign of thinking of others.
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".
The first minister added: "First of all, for women who believed his behaviour towards them was inappropriate.
"But also for those of us who have campaigned alongside him, worked with him, cared for him, and consider him a friend - who now stand unfairly accused of plotting against him."
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.
She went on to tell the cross-party committee of MSPs that Mr Salmond 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 inquiry is examining the Scottish government's botched handling of sexual harassment complaints made against Mr Salmond by two female civil servants.
Mr Salmond used his evidence session last week to accuse his former protege of repeatedly misleading parliament, and said he had "no doubt" she had breached the ministerial code - which she denies.
A separate inquiry headed by Irish lawyer James Hamilton is specifically looking at whether this was the case.
Ms Sturgeon is facing calls to quit from Scottish Conservatives after new documents released on Tuesday evening raised further questions about her involvement in the saga and appeared to back Mr Salmond's evidence.
They included government emails showing it continued a doomed legal fight with Mr Salmond despite its lawyers advising it was likely to lose.
It ended up paying Mr Salmond's legal fees of more than £500,000, on top of its own costs, after the investigation was found to have been unlawful and "tainted with bias" ahead of a judicial review.
Ms Sturgeon insisted that her meetings with lawyers had initially left her satisfied that the government was not "in some way prolonging a judicial review that was dead in the water".
She admitted that advice received shortly before it did finally admit defeat had been "dreadful" and "catastrophic", but said the government had taken a "legally sound" approach by then deciding to concede the case.
Labour's Jackie Ballie said the legal advice had only been handed over at the "11th hour" after two votes in parliament and the threat of a no confidence vote in the deputy first minister, and complained that some documents had not been provided.
The committee has regularly complained that its work was being obstructed by the government, with SNP MSP Linda Fabiani, who chairs the inquiry, saying that she shared Ms Baillie's frustration.
Ms Sturgeon insisted she had always acted "properly and appropriately" and there was "no intention" by the government to withhold information from the committee.
Was Mr Salmond told the name of a complainer?
Ms Sturgeon was questioned at length about claims the name of a complainer was passed to Mr Salmond while the meeting between a meeting between the two first ministers was being set up.
Mr Salmond said the name had been revealed to his former chief of staff Geoff Aberdein, and two other former SNP employees - Kevin Pringle and Duncan Hamilton - have written to the committee to support his account.
However Ms Sturgeon told the inquiry that she had been given assurances that "it did not happen in the way that has been described".
She said she believed that Mr Salmond was already aware of the identities of the two complainers, and that Mr Hamilton and Mr Pringle were not present at the meeting in question.
She said she was prevented from going into more detail due to legal constraints, but added: "I understand evidence has been given to this committee that denies that allegation, and I believe there has been an offer of confidential evidence as well."
As Ms Sturgeon was speaking, Mr Salmond's spokesman released a statement saying he had lodged a formal complaint with Scotland's top civil servant, Leslie Evans, about "the conduct of the official who is alleged to have breached civil service rules by disclosing the name of a complainant."
The view in Nicola Sturgeon's team tonight is there was no knock-out blow - no truly dreadful moment for the first minister. They seem pretty happy with her performance in eight long hours of questions.
There are still outstanding questions; the most significant of which is whether Ms Sturgeon broke the ministerial code.
The committee will provide an answer - but perhaps more significant is the view of James Hamilton, the Irish lawyer heading a separate inquiry into the issue. The view in Bute House is that his report will be hard to ignore.
The political debate over this is likely to continue in the coming days too. Ms Sturgeon's political opponents still believe her account is muddled and inconsistent.
Then there's Alex Salmond. He's sent documents to the committee today to support his evidence last week. Might we hear more from him in the coming days?
The first minister had originally told parliament she first became aware of the specific allegations against Mr Salmond when she met him in her Glasgow home on 2 April 2018.
But she subsequently claimed to have "forgotten" about an earlier meeting with his former chief of staff, Geoff Aberdein, in her Scottish Parliament office on 29 March when she says she was told "in general terms" that a "harassment-type issue had arisen."
Some committee members expressed scepticism that Ms Sturgeon could genuinely forget about such a meeting.
Ms Sturgeon said she had not taken an official record of her two meetings with Mr Salmond in her home because she thought this could "potentially compromise the confidentiality" of the complaints process.
She said if a meeting with Mr Salmond appeared in a diary then questions could be asked about it, and that there would be more risk to the complaints process if she told people within government that she was aware it was ongoing.
And she said she did not agree with Mr Salmond's assertion that there had been a "shared understanding" ahead of the meeting as to what was to be discussed - which would suggest she knew in advance about the allegations against him.
'I did not intervene'
Ms Sturgeon also denied claims that she had told Mr Salmond she would be willing to intervene in the case if necessary
But she said Mr Salmond had been a "long-standing friend and colleague", and she had therefore tried to let him down gently when he made the request - and accepted that she may not have been frank enough.
The first minister added: "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."
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.
She added: "Actually 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."
What has the reaction been?
Scottish Conservative leader Douglas Ross claimed that the abiding memory of the evidence session would be Ms Sturgeon repeatedly saying "I can't recall".
He added: "She dodged and evaded almost every difficult question. The first minister vividly remembers the details she believes exonerate her, then forgets entirely anything that damages her."
Scottish Labour MSP Jackie Baillie, who sits on the committee, said "serious questions remain" about the first minister's conduct.
She added: "Quite frankly we are not much further forward in understanding her role in this catastrophic failure of the Scottish government.
"Most galling of all was the first minister's complete failure to understand the obstruction that this Committee has faced and continues to face.
"The first minister promised the committee that it would receive all the information that it needed - this now sounds like a bad joke."