Humza Yousaf's decision to sack the Green Party from his coalition ultimately triggered a series of events that sealed his political fate, our Scotland correspondent Connor Gillies reports.
"It was the biggest political miscalculation of his career that sealed the fate of the first minister," he said, speaking after Mr Yousaf announced he will step down (see 12.04 post).
Ending the three-year powersharing deal at Holyrood was a "fatal mistake" which saw the "walls come closing in".
Those close to Mr Yousaf had suggested that agreement "had become a liability within government and many in the SNP were uneasy about how many strings they were pulling".
"So he got rid of them and that triggered a set of events in motion that ultimately led to this moment and ultimately led to his demise."
No confidence votes
No confidence motions were looming at the Scottish parliament later this week, and he was facing wipeout and a backlash of "no" votes from the Conservatives, Labour, the Liberal Democrats and the Green Party, who were furious.
"And then at that stage there was a suggestion that the ALBA party, Alex Salmond's party, would prop up the SNP government with their one MSP, Ash Regan," Gillies added.
"That was just a step too far. Allies and sources close to Scotland's first minister said, 'look, that would be like doing a deal with the devil'.
"So, there was only one other option and that was to resign."
Stepping in for Sturgeon
Gillies added an "interesting" element to this is how Mr Yousaf said to Sky News just 48 hours ago he would defy that vote of no confidence.
"On a human level, this is a man who is well-liked within the SNP," Gillies said.
"He is a man who stepped up to the plate when Nicola Sturgeon stepped down last year, and he was always going to have a battle ahead."
But even his closest of allies, Gillies said, would realise "he was not Nicola Sturgeon, and he did not command her authority".