The next leader of Scotland will be announced on Monday with the victor facing the challenge of uniting a country divided over its future and revitalising an independence movement that dreams of ending its three-centuries-long union with England.
The Scottish National Party (SNP), which runs Scotland's semi-autonomous government, has been plunged into crisis since Nicola Sturgeon, the country's longest-serving leader, announced last month she was standing down after eight years, saying she had become too divisive to lead the nation to independence.
The two main candidates to replace her have traded personal attacks while Sturgeon's husband, the chair of the party, was forced to resign after accepting the blame for misleading the public over a fall in party membership.
The SNP's unity, which had been one of its strengths, has broken down because of arguments over how to achieve a second independence referendum and the best way to introduce social reforms, such as transgender rights.
The bookmakers' frontrunner to become the next SNP leader is Humza Yousaf, a Sturgeon loyalist who has been criticised for his record in government including his handling of a health service struggling to recover from the Covid-19 pandemic.
Up against him are Kate Forbes, 32, the country's finance minister and a rising star whose views opposing same-sex marriage have lost her supporters, and Ash Regan, who quit the government in opposition to proposed changes to gender recognition.
The results of the leadership contest will be announced on Monday after 1300 GMT.
The political turmoil in Scotland relieves some pressure on British Prime Minister Rishi Sunak, who is dealing with waves of industrial action, high levels of inflation, and whose predecessors had to deal with repeated and angry demands by the SNP for a new independence referendum.
While about four in 10 Scots still support independence, the departure of Sturgeon - a charismatic and commanding leader - may slow some of the momentum behind a break up of the United Kingdom. There is no agreed strategy for how to force a new referendum - one of the reasons Sturgeon resigned.
Scotland voted against independence by 55% to 45% in 2014. Britain's vote to leave the European Union two years later when a majority of Scots wanted to stay, and Scotland's handling of the coronavirus pandemic brought new support for independence.
However, an opinion poll showed the backing for independence dropped to 39% this month after touching a record 58% in 2020.
Michael Russell, the president of the SNP, said a week ago the party was in a "tremendous mess".
In a series of personal attacks unprecedented in the party's recent history, Forbes clashed with Yousaf over his record in government, claiming the trains were never on time when he was transport minister, the police were at "breaking point" when he was justice minister and now, as health minister, patients have the longest ever waiting lists.
Yousaf responded by saying Forbes did not have the strength to fight for independence and claimed the LGBTQ community did not trust her because of her religious views.
One SNP member of parliament in London said the infighting had set the independence back a decade and the party had blown a favourable political environment to achieve their dream.
But he predicted Scotland would still gain independence from England in the long term, driven by support from a younger generation who are more supportive of it after they have grown up with more autonomy from a deal in 1998 to share power between London and Edinburgh.