Kezia Dugdale has resigned as leader of Scottish Labour, saying it is time to "pass on the baton" to someone else.
The Lothians MSP has previously criticised UK leader Jeremy Corbyn, and has faced criticism from left-wing members of her own party.
She insisted she was leaving the party in a much better state than she had found it.
But she said a new leader was needed with "fresh energy, drive and a new mandate".
Ms Dugdale said she wanted to give her successor the "space and time" to prepare for the next Scottish Parliament election in 2021.
And she strongly denied suggestions that she was leaving now in order to avoid being pushed out by supporters of Mr Corbyn.
In an exclusive interview with BBC Scotland's political editor, Brian Taylor, she said she had taken over the leadership when the party was "on its knees" in Scotland.

'Precious thing'

Ms Dugdale, who is leaving with immediate effect, said she had devoted "every waking moment of my life" to improving Labour's fortunes in Scotland, with a lot of progress being made and the party now ready for someone else to take it on the next stage of its journey.
She added: "I have thought long and hard about this. I care deeply about the Labour Party - I love it and I have devoted my adult life to serving it in a number of different capacities.
"And I have just come to the conclusion that the best thing for it, the Labour Party, this precious, precious thing that has done so much good in our country, and indeed for me, is to pass that baton on."

'Tireless service'

Labour leader Jeremy Corbyn thanked Ms Dugdale for her work as Scottish Labour leader and "the important role she has played in rebuilding the party in Scotland".
"Kezia became Scottish leader at one of the most difficult times in the history of the Scottish Labour Party, and the party's revival is now fully under way, with six new MPs and many more to come," he said.
"I want to thank Kez for her tireless service to our party and movement."
Kezia Dugdale and Jeremy CorbynImage copyrightGETTY IMAGES
Image captionMs Dugdale and Mr Corbyn appeared together in Glasgow last week
Former Labour leader Ed Miliband tweeted that Ms Dugdale had given her "heart and soul to leading Scottish Labour".
He added: "Thank You. You deserve to get your life back. Enjoy."
First Minister Nicola Sturgeon was among political opponents to pay tribute to Ms Dugdale
She wrote on Twitter: "We may be opponents, but @kezdugdale led her party with guts and determination and I admired her for that.
"I wish her well for the future."
And Scottish Conservative leader Ruth Davidson tweeted: "Leadership can be tough and @kezdugdale deserves the thanks of her party for putting in the hard yards. I wish her well."

'Mounting pressure'

Ms Dugdale replaced Jim Murphy as Scottish Labour leader in August 2015, after the party lost all but one of its Westminster seats in Scotland to the SNP.
Under her leadership, Labour finished third behind the SNP and Scottish Conservatives in last year's Scottish Parliament election - but went on to win seven seats in the snap general election in June.
Ms Dugdale backed Owen Smith to replace Mr Corbyn in last year's leadership contest, arguing at the time that: "I don't think Jeremy can unite our party and lead us into government."
Labour's stronger-than-expected performance in this year's general election has seen pressure mount on her from supporters of Mr Corbyn, who believe the party's improvement in Scotland was down to him rather than Ms Dugdale.
Mr Corbyn recently completed a five-day tour of Scotland, when he appeared alongside Ms Dugdale at events in Glasgow.

Analysis by Brian Taylor, BBC Scotland political editor

Kezia Dugdale was elected to Holyrood in 2011, after working for the former Labour MSP Lord Foulkes.
She was Jim Murphy's deputy as Scottish party leader - and replaced him in the top job when he stood down after the party's calamitous defeat in the 2015 UK general election which left Labour with only one Westminster seat in Scotland.
Initially highly critical of Jeremy Corbyn, she has since argued for party unity. However, that has not prevented elements of the left in Scotland from arguing that she should stand down or face a challenge.
There is no recrimination or name-calling in her departure. Rather, she pledges to continue to work for Labour as a list MSP.
But there is an oblique reference in her resignation letter to the tensions at the top, when she says that "being leader has always been a difficult but fulfilling challenge".
She adds it was a challenge that "until now" she had enjoyed.
Speculation will now centre upon her likely replacement. Contenders on the left might be Neil Findlay, Richard Leonard and the current deputy Alex Rowley. Other names mentioned include Anas Sarwar, Jackie Baillie, Jenny Marra and James Kelly.
Ms Dugdale's resignation takes immediate effect. Her deputy, Alex Rowley, will serve as acting leader - unless he decides to resign from his post to contest the leadership himself.

Ms Dugdale insisted she was not leaving now in order to avoid a possible challenge to her leadership from a more left-wing rival.
And she said Mr Corbyn has her full support, and that she expects him to become prime minister.
She said: "On a personal level we continue get on extremely well, and I wish him every success for the future".
In her resignation letter, Ms Dugdale also referred to the death earlier this year of her close friend Gordon Aikman, a Labour Party activist who died at the age of 31 after a battle with Motor Neurone Disease.
Ms Dugdale - who celebrated her 36th birthday this week - said his example taught her "how precious and short life was and never to waste a moment."
Ms Dugdale recently announced that she was dating SNP MSP Jenny Gilruthafter splitting with her long-term partner Louise Riddell.
She said she had thoroughly enjoyed her time as party leader, and believes she still has a lot to offer public life in Scotland - but stressed that would not always be in the Scottish Parliament, although she will remain as a backbench MSP for now.
And she admitted that the "immense" period in Scottish politics over the past three years, which has included the independence and EU referendums alongside two general elections and a Holyrood election, had taken its toll on her.
Ms Dugdale added: "Of course it is tough - it should be tough. It is important decisions you are taking all of the time, but I thoroughly enjoyed it.
"I have taken on some of the big battles of our time, whether that be around the constitution or making the case for progressive taxes.
"I have delivered two sets of diverse candidates, 50% men and 50% women, and I have guaranteed the autonomy of the Scottish Labour Party.
"Nobody has ever told me what to do in this job - it is not something dictated from London any more, that is beyond all doubt."

Full text of Kezia Dugdale's resignation letter:

Dear Linda,
As Chair of the party, I am writing to you today to resign as Leader of the Scottish Labour Party.
It has been an honour and a privilege to have served this party in a leadership position for the last two and a half years, covering four national elections and one referendum.
I have worked with many great people, not least the staff in our HQ led by Brian Roy and those in the Scottish Parliament, whose boundless energy, expertise and good humour has guided our party through some dark hours and difficult times.
I'd like to thank my shadow cabinet for their efforts, and in particular Iain Gray for his unflinching love and support and James Kelly for the thankless but crucial job he does so well as our Business Manager.
Earlier this year I lost a dear friend who taught me a lot about how to live. His terminal illness forced him to identify what he really wanted from life, how to make the most of it and how to make a difference. He taught me how precious and short life was and never to waste a moment.
Being leader has always been a difficult but fulfilling challenge. One that until now I have enjoyed, driven by a clear guiding purpose and goals, many of which I have achieved.
I am proud of the fact that I've demonstrated how the parliament's powers can be used to stop austerity with progressive taxes and the creation of new benefits. Proud to have advanced the call for federalism across the UK. Proud to have delivered real autonomy for the Scottish Labour Party and a guaranteed voice for Scotland and Wales on the NEC.
Educational inequality is the number one issue in Scottish politics after the constitution because Scottish Labour under my leadership put it there.
I am proud to have delivered 50/50 slates of amazing and diverse candidates in both the Scottish and U.K. Elections and equally proud to have invested in the next generation of labour activists and parliamentarians with leadership programmes. These have already furnished us with two of our magnificent seven MPs. With that re-established Scottish Labour group at Westminster, and a talented and effective group in Holyrood, Scottish Labour has a bright future.
A marker of success for me was to leave as leader with the party in better shape than I found it and I have done that.
Emerging from the challenging times following the 2014 referendum, and the 2015 UK election, we now have a solid platform on which to build towards success, and government.
I have given the task of achieving this all that I have. But with nearly four years now until the next Scottish Parliament elections, I am convinced that the party needs a new leader with fresh energy, drive and a new mandate to take the party into that contest.
I will continue as a Labour MSP for the Lothians and am already looking forward to spending more time with constituents and on constituency issues.
Too often our leaders leave in a crisis, with scores to settle. I love this party too much for that to be my way. There will be no press conference and no off the record briefing in my name. I choose to stand down because I believe it is best for me and best for Scottish Labour, at a time when we can be positive and optimistic about our future.
I remain in awe of all those party activists who devote their time to this movement without pay or reward. I thank them for their belief in me.
Yours in solidarity,
Kez Dugdale
 
Top