Nicola Sturgeon has survived a vote of no confidence in her leadership after a Holyrood committee found she misled parliament.
A total of 31 MSPs backed the motion, with 65 voting against. There were 27 abstentions.
The Scottish Conservatives tabled it, but the move was always expected to fail after the Scottish Greens said they would not support such a vote.
Please use Chrome browser for a more accessible video player
It comes after a cross-party committee of MSPs found the Scottish government’s handling of harassment complaints against Alex Salmond was “seriously flawed”.
The Committee on the Scottish Government Handling of Harassment Complaints report has concluded the women who made the allegations were “badly let down”.
It also found it was misled by Ms Sturgeon following its investigation into the government’s unlawful handling of allegations against Mr Salmond.
The findings are separate from those of James Hamilton, who reported on Monday that there had been no breach of the ministerial code by the first minister over her role in the saga.
Speaking during the debate, Ms Sturgeon said she would have quit if she had been found to have broken the code.
“Had Mr Hamilton’s report gone the other way, I would have accepted it, had he found that I had breached the code in anything other than the most technical and immaterial of ways, I would have been standing here right now tendering my resignation,” she said.
Please use Chrome browser for a more accessible video player
“The integrity of the office I am so privileged to hold really does matter to me.
“The office of first minister is more important than any temporary incumbent of it.”
And in a message for the Scottish Tories, she told them: “If you think you can bully me out of office, you are mistaken and you misjudge me.
“If you want to remove me as first minister, do it in an election.”
The first minister added: “If today’s desperate political stunt proves anything, it is that you have no confidence whatsoever in your ability to do so, because you have nothing positive to offer the Scottish people.”
Ruth Davidson, leader of the Scottish Conservatives, said Ms Sturgeon should have done the “honourable” thing and stood down after being found to have misled parliament.
“After all that evidence-gathering and deliberation, the committee found that Nicola Sturgeon misled this parliament, nothing can erase that fact, however inconvenient it is to the first minister and her supporters,” she said.
Please use Chrome browser for a more accessible video player
“And let’s remember, that by misleading this Scottish parliament, she misled the people of Scotland too.
“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 judged guilty of misleading it.
“How can parliament have confidence in the words of a first minister when those words have been found to be false?
“The honourable thing would be to resign.
“Whether the first minister has that sense of honour is now between her and her conscience.”
Scottish Labour leader Anas Sarwar took aim at both the Tories and the SNP, telling MSPs: “We cannot support a motion which is designed, not to deliver the kind of strong opposition they promised, but purely at dividing our country and our politics still further.
“A failing government on one hand; a game-playing opposition on the other.”
He added: “The Conservatives have shown themselves as only interested in removing Nicola Sturgeon from office, rather than the facts of this terrible series of events. They have undermined the integrity of the independent investigator.
“Yet even the most ardent SNP supporter must recognise the women who complained were let down by the government and that half a million pounds was wasted defending the indefensible in court.”