The future of Scotland’s first minister is far from secure after a week of turmoil.