Humza Yousaf is to succeed Nicola Sturgeon as SNP leader and Scotland’s first minister after a vote of party members.
Mr Yousaf defeated rivals Kate Forbes and Ash Regan in a leadership contest that exposed deep divisions within the party.
The 37-year-old is the first Muslim to lead a major UK party.
He is set to be confirmed as the first ethnic minority leader of a devolved government on Tuesday.
Mr Yousaf is currently Scotland’s health secretary and was widely assumed to be Ms Sturgeon’s preferred successor, although she did not explicitly back any of the candidates in the contest.
The leadership election was decided by the Single Transferable Vote system, with 50,490 of the SNP’s 72,169 members casting a ballot – the vast majority of them online.
After Ms Regan was eliminated in the first round, Mr Yousaf defeated Ms Forbes by 52% to 48% in the second round, with Mr Yousaf receiving 26,032 votes and Ms Forbes 23,890.
The new SNP leader will face a vote in the Scottish Parliament – which he is virtually certain to win – on Tuesday before becoming Scotland’s sixth first minister.
He had been the clear favourite with the bookmakers during the contest, with some pundits surprised at how close the final result was.
Ms Forbes, a member of the evangelical Free Church of Scotland, had been attacked by the SNP hierarchy during the contest over her socially conservative views on issues such as gay marriage, abortion and having children outside of marriage.
Speaking after the result was announced at Murrayfield Stadium in Edinburgh, Ms Yousaf said it was the “the greatest honour and privilege of my life” to be the next first minister, should parliament decide to elect him.
And he called on the party to unite behind him after what has often been a fractious leadership contest.
He said independence would be won “on the doorsteps” and pledged to kickstart a grassroots campaign, adding: “We will be the generation to win independence for Scotland”.
Mr Yousaf added: “In the SNP we are a family. Over the last five weeks we may have been competitors or supporters of different candidates.
“We are no longer team Humza, or team Ash, or team Kate, we are one team.”
Mr Yousaf also said his grandparents had arrived in Scotland from Pakistan in the 1960s barely able to speak a word of English, and would not have believed “in their wildest dreams” that their grandson would one day become first minister of Scotland.
Ms Sturgeon, who was Scotland’s longest-serving first minister, announced last month she was stepping down after more than eight years in the job.
She said Mr Yousaf will be an “outstanding” leader as she congratulated him on his appointment, adding: “I could not be prouder to have him succeed me”.
It was the first time the SNP has had a leadership contest since 2004, with Ms Sturgeon being unopposed when she replaced Alex Salmond in 2014.
Mr Yousaf becomes only its fifth leader since 1979, and will face the task of uniting a party that has dominated Scottish politics in recent years but which has looked deeply divided in the wake of Ms Sturgeon’s resignation.
Mr Yousaf was seen as the “continuity candidate” throughout the campaign – a strong position given Nicola Sturgeon’s enduring popularity with SNP members.
He had by far the most endorsements from MSPs and MPs, including most of Ms Sturgeon’s inner circle.
That means he should have a relatively easy time putting together a cabinet and bringing the party back together in parliament.
He was also the candidate best-placed to bring the Greens back into government, although they are meeting this afternoon to decide their next steps.
But it is inescapable that Mr Yousaf’s margin of victory was razor-thin. A big, big chunk of the SNP voted for candidates promising change.
So the question now will be the extent to which the “continuity candidate” seeks to differentiate himself from his predecessor’s agenda. Will he forge on with all of her policies, or seek to carve out more of an identity for himself?
And given he only just won over half of his own party, will he be able to replicate Ms Sturgeon’s popularity with the broader electorate when the next election rolls around?
Mr Yousaf had pitched himself to some extent as the “continuity candidate” during the leadership campaign, and was forced to deny claims that the SNP establishment was doing everything it could to ensure he won.
He has often spoken of his admiration for Ms Sturgeon, but insists that he is “his own man and will do things my own way”.
He was on the receiving end of a withering attack from Ms Forbes in a live STV debate, when she told him: “You were transport minister and the trains were never on time, when you were justice secretary the police were stretched to breaking point, and now as health minister we’ve got record high waiting times”.
But Ms Forbes congratulated him on his success, saying: “Whatever the robust disagreements or frank exchanges of the last few weeks, I am confident we will unite behind Humza as our new party leader in the shared and common objective of independence.”
His supporters say Mr Yousaf is a polished communicator who is best placed to unite the party and maintain the power-sharing agreement with the Scottish Greens – which had been widely expected to collapse if either Ms Forbes or Ms Regan had won.
A spokesman for the Greens hailed Mr Yousaf’s victory in the leadership contest as an endorsement of “shared values” between the two parties.
Mr Yousaf was first elected in 2011 as a regional MSP for Glasgow and was appointed a junior minister the following year, before becoming justice secretary in 2018 and health secretary three years later.
Douglas Ross, the leader of the Scottish Conservatives, said he had “serious concerns” about Mr Yousaf’s ability, adding: “We hope he does not lurch from failure to failure as he did when he was Nicola Sturgeon’s health secretary, justice secretary and transport minister”.
Scottish Labour leader Anas Sarwar – who was at school with Mr Yousaf at the Hutchesons’ Grammar private school in Glasgow – said the election of a first minister from an ethnic minority background was a “significant moment for Scotland”.
But he said Mr Yousaf was inheriting “the SNP’s woeful record, but he has not inherited Nicola Sturgeon’s mandate”, and called for a Holyrood election to be held.