Ruth Davidson has quit as leader of the Scottish Conservatives after eight years in the job.
In a statement she said it had been the “privilege of my life” to have led the party.
But she added that “much had changed” both politically and personally, which had led her to tender her resignation.
Ms Davidson had a baby last year, and has been a vocal critic of Prime Minister Boris Johnson – particularly over his approach to Brexit.
She said her personal priorities had changed, and the prospect of spending hundreds of hours away from her son and partner during a possible election campaign now filled her with “dread”.
The Scottish Conservatives deputy leader Jackson Carlaw is to be appointed interim leader.
The 40-year-old, who will continue as the MSP for Edinburgh Central, tweeted her resignation statement shortly before addressing the media at an event in Edinburgh on Thursday morning.
Conservative sources insisted that her decision to leave the post had been building for several months, and was not a direct result of Mr Johnson announcing that he would suspend parliament for several weeks ahead of the Brexit deadline on 31 October.
Ms Davidson has been widely credited with turning around the fortunes of the Tories in Scotland, but backed opponents of Mr Johnson in the Conservative leadership race and has said she could not support a no-deal Brexit.
She said she had tendered her resignation with a “heavy heart”, and pledged to continue to support the party and the prime minister “from the backbenches and beyond”.
Mr Johnson paid tribute to Ms Davidson’s “incredible leadership”, which he said had been “instrumental in the revival of our electoral fortunes in Scotland”.
The prime minister added: “She should take immeasurable pride in the pivotal role she played during the Scottish independence referendum campaign, where her passionate support for our Union was crucial to the result”.
Her deputy, Jackson Carlaw, will become acting leader – a role he filled during Ms Davidson’s maternity leave – until a permanent successor is chosen.
Ms Davidson backed Remain ahead of the EU referendum and famously clashed with Mr Johnson in a BBC TV debate at Wembley ahead of the vote – when she accused the Leave side of telling “untruths”.
‘Fills me with dread’
She said she had never sought to hide the “conflict” she felt over Brexit, but had attempted to “chart a course for our party which recognises and respects the referendum result, while seeking to maximise opportunities and mitigate risks for key Scottish businesses and sectors”.
However, she said the biggest change she had faced was starting a family last year with her partner Jen Wilson.
Ms Davidson added: “As I look to the future, I see the Scottish election due in 2021 and a credible threat from our opponents to force a general election before then.
“Having led our party through seven national elections and two referenda, I know the efforts, hours and travel required to fight such campaigns successfully.
“I have to be honest that where the idea of getting on the road to fight two elections in 20 months would once have fired me up, the threat of spending hundreds of hours away from my home and family now fills me with dread. That is no way to lead.”
She also said she feared her focus on being a “good leader” in recent years had made her a “poor daughter, sister, partner and friend”, and that the arrival of her son Finn last October “means I now make a different choice”.
When she returned to the Scottish Parliament from maternity leave in May, she told BBC Scotland that it would be “tough to tear myself away from the wee man” but that “having a child and coming back to work is a part that lots of women play”.
Under her leadership, the Scottish Conservatives more than doubled their number of seats at Holyrood in the 2016 election – making the party the second biggest behind the SNP. The following year it increased its MPs from one to 13 in the general election.
That relative success had seen her tipped as a future UK Tory leader and prime minister, but she insisted she had no interest in the job – and that she was focused only on replacing Nicola Sturgeon as first minister of Scotland at the next Holyrood election in 2021.
She also said in her resignation statement that her party’s electoral successes had paled in significance compared to the role it had played in the campaign to keep Scotland in the UK during the independence referendum campaign.
She added: “It was – without doubt – the most important contribution of my working life and, I believe, will remain so.”
Is independence now more likely?
Analysis by Sarah Smith, Scotland editor
Ruth Davidson’s unique selling point has always been that she doesn’t look like and doesn’t sound like a Tory, so she could persuade people who had never previously considered voting Conservative to at least give them a hearing.
She was helped enormously by the fact that the dominant issue in Scottish politics throughout her eight years as leader has been Scottish independence.
As a fierce advocate of staying in the UK, she attracted Unionist votes from other parties and became the standard bearer for keeping the kingdom united.
Since Boris Johnson became PM we have seen the first opinion poll in years that suggests more Scots might vote to leave the UK than to stay.
I realise that anecdotes are not evidence, but I am struck by how frequently I hear people all over the country saying that they have now changed their minds and would vote for independence if there was another referendum.
Without the dynamism and charisma of Ruth Davidson leading the campaign for the UK, where will a future Better Together campaign get its energy from?
Her spokesman today would not be drawn on whether she might be persuaded to play a leading role in a future referendum campaign.
Ms Davidson enjoyed a close working relationship with former prime ministers David Cameron and Theresa May.
But she was said to have been angered by Mr Johnson’s decision to sack David Mundell – a close political ally of hers – as Scottish secretary and replace him with Alister Jack.
Responding to her resignation, Mr Jack paid tribute to her “inspirational and transformational” leadership, adding that she had “made the Scottish Conservatives the only credible challenger to the SNP in Scotland”.
First Minister Nicola Sturgeon tweeted: “I know well the toll political leadership can take on family life, and no one will grudge her more time with her young son.
“There will be opportunity later to discuss the politics of her decision – but for now, I’ll simply send my best wishes.”
Scottish Labour leader Richard Leonard said the loss of Ms Davidson would be a “real blow to her party” and would demonstrate that Mr Johnson was already losing support and credibility within his own ranks.
Scottish Greens co-leader Patrick Harvie said Ms Davidson was due some credit for “ending the pretence and resigning”, while Scottish Lib Dem leader Willie Rennie said Ms Davidson had “run out of reasons to stand by this dangerous and power hungry prime minister”.