Nicola Sturgeon has announced she is resigning as Scotland's first minister after more than eight years in the role.
The Scottish National Party leader said she knew "in my head and in my heart" this was the right time to step down.
Ms Sturgeon said she would remain in office until her successor was elected.
She is the longest-serving first minister and the first woman to hold the position.
Ms Sturgeon insisted her resignation was not in response to the "latest period of pressure", which has included controversies over gender reforms, trans prisoners and the strategy on independence.
She acknowledged there had been "choppy waters", but said her decision had come from "a deeper and longer-term assessment".
"Since the very first moment in the job, I have believed that part of serving well would be to know, almost instinctively, when the time is right to make way for someone else," she said.
"And when that time came, to have the courage to do so, even if many across the country, and in my party, might feel it too soon.
"In my head and in my heart I know that time is now. That it is right for me, for my party and for the country.
"And so today I am announcing my intention to step down as first minister and leader of my party."
"I get up in the morning and I tell myself, and usually I convince myself, that I've got what it takes to keep going and keep going and keep going," she said.
"But then I realise that that's maybe not as true."
She said there were two questions - whether carrying on was right for her, and whether it was right for country, her party and the cause of independence.
Ms Sturgeon said the answer to both questions was no.
"We are at a critical moment," she said. "The blocking of a referendum as the accepted, constitutional route to independence is a democratic outrage.
"But it puts the onus on us to decide how Scottish democracy will be protected and to ensure that the will of the Scottish people prevails."
She said that support for independence needed to be "solidified" and to grow further.
"To achieve that we need to reach across the divide in Scottish politics, and my judgement now is that this needs a new leader," she said.
Nominations to elect her successor have now opened. Names to have been suggested as potential candidates include John Swinney, Kate Forbes and Angus Robertson.
The SNP Westminster leader Stephen Flynn told the BBC he would not be standing.
Ms Sturgeon said she was "not leaving politics" and would continue to fight for Scottish independence.
She added that the intensity and "brutality" of life as a politician had taken its toll on her, and those around her.
The first minister said leading the country through the Covid pandemic had been "by far the toughest thing I've done" and that she had only recently started to comprehend its physical and mental impact.
Scottish Labour leader Anas Sarwar said the first minister had led Scotland through some of the most "challenging times" in recent history.
He said: "It is right that today we pay tribute to those achievements, particularly during the pandemic.
"Regardless of our differences, she is an able politician who has stood at the forefront of Scottish politics for more than 20 years."
Prime Minister Rishi Sunak paid tribute to Ms Sturgeon "for her long-standing public service".
He said they "didn't agree on everything" but had successfully worked together on freeports.
Scottish Conservative leader Douglas Ross MSP said: "Whatever our differences, it is right we recognise that political leadership is always demanding and takes its toll on a person and their family."
But he added that Ms Sturgeon had "presided over a decade of division and decay in Scotland".
Former first minister and SNP leader Alex Salmond, who now leads the Alba party, said he felt for Ms Sturgeon personally - but that there was no obvious successor and no clear strategy for independence.
Deputy First Minister John Swinney said he was "very sorry" at the first minister's decision but "completely understands" her reasons.
"It's obviously been a shock to all of us, a shock to the SNP family and shock to the country as well," he said.
The SNP's Westminster leader Stephen Flynn said Ms Sturgeon had been an "outstanding political leader".
"She has taken support for independence to record levels and won every national election, by margins other parties could only wish for," he said.
Ms Sturgeon has been a member of the Scottish Parliament since 1999, and became the deputy leader of the SNP in 2004.
She has been first minister since November 2014, when she took over from Alex Salmond after the defeat in the independence referendum.
Ms Sturgeon has led the SNP to a series of election victories at UK, Scottish and local level.
Last year the UK Supreme Court ruled that Holyrood did not have the power to stage another independence referendum - a move which has been blocked by the UK government.
Ms Sturgeon wants the SNP to fight the next general election as a de facto referendum, but there has been some opposition to the plan within the SNP.
In addition, recent months have seen controversies over gender reforms, which have been blocked by the UK government; a teachers' strike; and rows over the management of transgender prisoners.