A motion lodged by the Scottish Conservatives in the wake of the James Hamilton report, which cleared the First Minister of breaching the ministerial code, and a parliamentary committee report that stated Ms Sturgeon had misled the Scottish Parliament over when she had first known about the allegations of sexual harassment against Alex Salmond, was defeated by 65 votes to 31 on Tuesday.
The Scottish Greens voted with the SNP to support Ms Sturgeon, while Labour and three of four Liberal Democrat MSPs, as well as independent MSP Andy Wightman, abstained.
One Scottish Liberal Democrat, Mike Rumbles, voted with the Conservatives for the motion.
In the debate before the vote, Ms Sturgeon said if Mr Hamilton had found she had breached the ministerial code, she would have been standing in the Parliament tending her resignation, but added she would not be "bullied" out of office by the Tories.
"There are some in this chamber who decided before a single word of evidence was heard that I was guilty in relation to handling of complaints against the former first minister,” she said.
"I have faced accusations of conspiracy against, collusion with, and cover up on behalf of Alex Salmond. None of that is supported by evidence because none of that is true.
"But for some, getting to the facts, learning lessons and making sure women are not let down in future were secondary considerations to the desperate attempt to claim my political scalp.”
Apologising again to “the women who were let down”, Ms Sturgeon said if the Hamilton report “found I had breached the code I would be standing here right no tendering my resignation, because the integrity of the office I am so privileged to hold really does matter to me”.
She said: "Given that I have been cleared by that independent report of any breach, then my message to all those, especially to the Conservatives who refuse to accept Mr Hamilton’s conclusions, is this – if you think you can bully me out of office you are mistaken and misjudge me. If you want to remove me as First Minister, do it in an election.”
However, Ruth Davidson said her party had brought the motion because the government had “attempted to defend the indefensible” over its handling of the process, which saw it lose a judicial review and more than £500,000, and because “nobody has taken responsibility of the multiple failings that occurred at every level".
She accused SNP MSPs of “traducing” the parliamentary investigation and committee and making “baseless claims regarding its outcomes”.
Ms Davidson said the decision on whether the First Minister had misled Parliament was up to the Parliament, as Mr Hamilton had stated in his report and that her party would support any investigation into the leaking of some of the conclusions of the committee report last week.
But she added: “Nicola Sturgeon misled this Parliament and nothing can erase that fact … and by misleading the Parliament, she misled the people of Scotland. No First Minister who truly wanted to live up to the ideals of this Parliament should feel able to continue in post after having been judge guilty of misleading it.
“The honourable thing would be to resign.”
Anas Sarwar, Scottish Labour’s new leader, said it was a “day of shame” for Parliament and MSPs were “confronted by a litany of government failings which led to two women being so badly let down”.
His party abstained on the vote, but he said the whole episode surrounding the failure of the government to deal with the complaints of the two women civil servants had “shaken trust in the system” and “risked discouraging victims to come forward”.
He added: “It has called into question the integrity of government. It has undermined the principles of transparency and accountability. It has seen a misuse of public money.
“There are huge failures and big questions to be answered. There are no winners in this debate
“Not the SNP. The spectacle of using a harassment inquiry as a recruitment tool was grotesque. And the Tories, in the face of all these failures, playing politics, interested only in getting a scalp.
“Scotland deserves a better government. And it deserves a better opposition.”
Willie Rennie, leader of the Scottish Liberal Democrats, agreed there were “no winners”.
He said: “Scottish politics does not look pretty. Talk of lynching, of assassination, leaking the private evidence of complainants, tabling motions of no confidence before evidence is heard, attacking a committee because it does not agree with the First Minister, lauding the performance of Nicola Sturgeon because she talked to a committee for eight hours as if the show is more important than the facts, boasting of recruiting new members on the back of this tragedy – no-one wins from this ugly episode.”
Scottish Greens co-leader Patrick Harvie said leaks had shown contempt for the process and destroyed the credibility of the committee report. He said the MSPs who had leaked had “broken rules, abused the trust of witnesses and played childish games”, adding they “should be the ones resigning today”.
Deputy First Minister John Swinney admitted the government had made mistakes, adding “we accept that criticism and have apologised for it”.
But he said: “Those women were also very badly let down by somebody who was a member of the committee by leaking a misrepresentation of their evidence to a Sunday newspaper. Whomever was responsible for it are unfit to be a member of this Parliament.”
Referencing to the Covid emergency, he said: “She [Nicola Sturgeon] has done everything she can to protect the people of Scotland and the last thing she needs is this grubby motion and I urge people to chuck it out at the first opportunity.”