Scottish First Minister Humza Yousaf is battling for political survival. How did we get here - and what happens next?

Scotland's First Minister Humza Yousaf is battling to save his job as he faces a knife-edge no-confidence vote.

The SNP leader triggered a crisis at Holyrood after he dramatically brought the power sharing deal with the Scottish Greens to an end.

Follow live updates in the Politics Hub

The backlash has plunged Mr Yousaf's future into doubt, although party colleagues insist he will not resign.

How did we get here?

The Bute House Agreement - signed back in 2021 and named after the first minister's official residence in Edinburgh - brought the Green Party into government for the first time anywhere in the UK.

It gave the SNP a majority at Holyrood when the votes of its MSPs were combined with those of the seven Green members, and also made Green co-leaders Patrick Harvie and Lorna Slater junior ministers.

Without it, the SNP would need to have operated as a minority administration at Holyrood.

What caused the relationship to sour?

There had been mounting tensions between the largest party at Holyrood and their junior partners in government.

The Greens were angered at the SNP-led administration's recent decision to ditch a key climate change target.

That, combined with the decision to pause the prescription of new puberty blockers to under-18s at Scotland's only gender clinic, resulted in the Greens announcing they would have a vote on the future of the power sharing deal.

What brought things to a head?

Mr Yousaf decided to pull the plug on the agreement - arguing it had "served its purpose" - prompting a major fallout with his former allies, who vowed to back a no-confidence motion in his leadership proposed by Scottish Conservative leader Douglas Ross.

So how do the numbers stack up?

Tight to say the least.

As the leader of a now minority government, Mr Yousaf's fate is set to depend on just one vote - that of a former SNP leadership rival.

In the Scottish parliament, the SNP has 63 seats out of 129, two short of an outright majority.

The Greens voting in favour of the no-confidence motion would mean 64 MSPs do not back the first minister.

The presiding officer Alison Johnstone, the equivalent of the Commons speaker, traditionally does not vote and would only so so in the event of a tiebreak and would be expected to support the status quo - so back the first minister.

That leaves Ash Regan, the one-time SNP leadership rival to Mr Yousaf who defected to Alex Salmond's Alba Party last October.

She has written to the first minister, setting out demands in exchange for her support.

When will the vote be held?

Any no-confidence vote in Mr Yousaf is likely to take place next week, with timings to be confirmed by parliamentary business managers who are expected to meet on Tuesday.

What happens if Mr Yousaf loses?

The vote is not binding and so he would not be forced to step down - but he would be under immense pressure to quit, and his position likely to be judged untenable if he did not have the confidence of most MSPs.

However, the resignation of the first minister would not automatically trigger a Holyrood election, with a 28-day grace period for MSPs to choose a replacement.

This means that if Mr Yousaf was to quit, the SNP may seek to have a replacement leader installed in the post - assuming they could muster enough support.

Is that all?

No. Scottish Labour leader Anas Sarwar says he will separately lay a motion of no confidence in the Scottish government.

While this carries more far-reaching implications by compelling ministers to resign and raising the prospect of an election, it is unlikely to succeed.

Alba has already ruled out its pivotal support, accusing Mr Sarwar of "grandstanding".