The Scottish government has survived a vote of no confidence at Holyrood.
Scottish Labour pressed ahead with its motion despite Humza Yousaf announcing earlier this week his intention to stand down as SNP leader and first minister.
It failed by 58 votes to 70.
The Scottish Greens voted against the motion, with party co-leader Patrick Harvie branding it “chaos for the sake of chaos”.
If it had passed, all ministers in the minority SNP government would have been forced to quit.
Opening the debate, Scottish Labour leader Anas Sarwar thanked Mr Yousaf for his service and wished him well, but said Scotland was “crying out for change” from the UK Conservative government and the SNP Scottish government.
He said the country needed “credible and effective leadership” to deal with “twin crises” in the economy and NHS.
First Minister Humza Yousaf says toxic leadership contest would harm SNP and independence movement
Scottish government to face Holyrood vote of no confidence
Next SNP leader could be ‘crowned’, claim Tories – as John Swinney leads field
Mr Sarwar added: “I have no confidence in the SNP’s ability to deliver that and that is why I am bringing this motion to parliament today.”
The outgoing first minister defended his government’s record, adding that in the 13 months he has spent in charge he had not “heard a single positive idea” from Scottish Labour.
Mr Yousaf added: “What I have heard is the deafening sound of principle after principle being thrown out of Anas Sarwar’s window.
“U-turning on the two-child cap, U-turning on the devolution of employment law, U-turning on the devolution of drug law, U-turning on his support for Waspi women.”
Mr Yousaf said pro-UK parties, in their “cosy Westminster alliance”, would be “terrified” of a vote of no confidence.
He added: “As I have found out only too well in the last few days, politics is definitely about the choices we choose to make.
“As a government, I am exceptionally proud of our choices.”
Please use Chrome browser for a more accessible video player
The debate and vote has come following the breakdown of the Bute House Agreement.
Within hours of the powersharing deal with the Scottish Greens coming to an end last week, Scottish Tory leader Douglas Ross announced he would be bringing a motion of no confidence in the first minister.
Angry over the way the party was dumped from government, the Scottish Greens announced its MSPs would be backing the motion.
Scottish Labour then announced it was planning a motion of no confidence in the Scottish government.
Mr Yousaf reached out to his political opponents in an effort to stem the uprising but conceded that he had “underestimated the level of hurt and upset” his actions had caused Scottish Green colleagues.
Keep up with all the latest news from the UK and around the world by following Sky News
Speaking to Sky News earlier on Wednesday, Mr Yousaf said: “I will certainly be regretting the way it ended.”
The Scottish Tories dropped their motion following Mr Yousaf’s resignation, but Scottish Labour pressed on as the party believes the decision on the next first minister should be put to the public.
Mr Yousaf intends to remain in post until his successor is announced.
Read more:
Who could replace Humza Yousaf?
What happens now following his resignation
SNP stands at a crossroads – what direction will party take?
Former deputy first minister John Swinney and ex-finance secretary Kate Forbes have emerged as potential frontrunners to throw their hat into the ring.
Mr Sarwar pointed to reports that Ms Forbes could struggle to appoint ministers and described Mr Swinney as “the finance secretary that broke the public finances and the worst education secretary in the history of the Scottish parliament”.
Mr Ross, whose party threw its support behind the Scottish Labour motion, was forced to apologise to Mr Swinney after referring to him as “not so honest John” in the Holyrood chamber.
Mr Ross was first reprimanded for referring to Mr Swinney as “honest John”, but when presiding officer Alison Johnstone reminded him not to use nicknames, he said: “Oh sorry, I thought it was on accuracy because it would be not so honest John with some of the things we’ve heard recently.”
Apologising, Mr Ross said: “I will apologise. I’m very sorry for any hurt caused.”
The Scottish Tory leader added: “Whether we have a bitter battle or a cosy coronation to elect the next leader of the SNP, they will continue campaigning for independence and the Scottish people will continue to be failed by them.”