The SNP was plunged into crisis on Thursday after a key member of the Scottish government’s cabinet - finance secretary Derek Mackay - was forced to resign.
So, what could it mean for Scotland’s largest party, Nicola Sturgeon’s leadership and the chances of a second Scottish independence referendum?
What happened?
Finance secretary Derek Mackay quit his cabinet post amid reports he has been contacting a 16-year-old boy.
Mackay admitted he had “behaved foolishly”, following reports he sent hundreds of messages.
In one message he is alleged to have asked “And our chats are between us?” and when the boy agreed, the minister told him: “Cool, then to be honest I think you are really cute.”
Sturgeon said Mackay had “taken full responsibility” for his actions and “apologises unreservedly”.
Why does it matter for the SNP and Nicola Sturgeon?
It is a huge blow for the first minister as Mackay was her closest ally in Holyrood and was widely seen as her preferred successor.
This scandal almost certainly ends any ambition Mackay had for the top job, if not his career in politics altogether.
To be clear, there is no vacancy for the role of SNP leader and Sturgeon has repeatedly made clear she will lead the party into the 2021 Holyrood elections.
She also wants to lead the next campaign for Scottish independence if a second referendum is granted.
But, make no mistake, this puts the FM in an incredibly difficult spot.
Mackay’s resignation came just hours before he was due to deliver the Scottish budget and as her Holyrood administration grapples with a crumbling NHS and a review of its education policies north of the border.
It heralds the start of what could be a testing year for party unity as former leader Alex Salmond is due to face trial in March on a series of sexual offences against ten women, which he denies.
A separate investigation is also taking place to determine if Sturgeon breached the ministerial code in a series of meetings and telephone conversations she is said to have had with Salmond, while the Scottish government was looking into complaints about the former FM.
This will all unfold as the party prepares to set out its stall for Scottish Parliament elections in May next year, so Sturgeon losing such a close ally at this time leaves her exposed to internal critics.
Does it change who could emerge as the next leader?
Figures such as Edinburgh South West MP Joanna Cherry, former MEP Alyn Smith and former Westminster leader Angus Robertson are thought to harbour leadership ambitions and may run for a Holyrood seat.
Closer to home, Kate Forbes, the economy minister who today steps in to deliver the budget, is regarded as a potential leader.
Former leader John Swinney and constitution minister Mike Russell are also two old hands who would be considered as reliable caretakers should crises engulf Sturgeon.
What does it mean for the chances of a second independence referendum?
The chances of Nicola Sturgeon securing a second independence referendum are tightly bound up with the SNP’s electoral prospects as the Scottish government need to secure an undeniable mandate for a re-run.
The power to grant a new plebiscite rests with Boris Johnson and the prime minister has made plain that the answer is no.
Pressure is mounting, however, over whether it is politically sustainable for Johnson to hold this position.
Polls in recent days show a majority in Remain-voting Scotland are for independence.
The general election was a huge success for the SNP, with Sturgeon regaining control of 13 seats, ousting Conservatives, Labour and the former Lib Dem leader, and staunch unionist, Jo Swinson.
The SNP currently governs in Holyrood with the support of the pro-independence Green Party.
If Sturgeon is successful in winning a majority again next May, it would mean parties for independence would be in power for almost two decades - which is a powerful argument.
This calamity could damage the party’s in the eyes of the public but the SNP’s continued success at the ballot box is largely down to party unity.
Despite the party dominating Scottish politics, the SNP consistently leads in the opinion polls, but it remains to be seen whether this incident, and the Salmond trial, could strain the main fault-line in SNP politics, which is between campaigners who see independence achieved gradually via devolution and good government and those who demand an independence vote now.