Nicola Sturgeon has resigned as Scotland’s first minister after more than eight years in the job.
The Scottish National Party leader will step down after a successor is appointed.
She made a formal announcement at a press conference in Edinburgh on Wednesday morning.
“I believe that part of serving well would be to know, almost instinctively, when the time is right to go,” Sturgeon said.
“In my head and in my heart I know that time is now.”
Sturgeon has been first minister since November 2014, when she took over from Alex Salmond following the independence referendum.
She has been the country’s longest-serving first minister.
The news came as a surprise after Sturgeon insisted just three weeks ago she was “no where near” ready to quit as Scotland’s first minister.
Sturgeon also told the BBC last month she would “like to think” she would be the leader to take Scotland out of the UK.
However, BBC chief political correspondent Nick Eardley reported a source close to her saying: “She’s had enough.”
Sturgeon has recently been embroiled in a row over her government’s attempt to make it easier for people to legally change gender.
The plans have now been blocked by Westminster but triggered a leadership crisis.
Internal dissent, almost unheard of in the SNP, broke out over Sturgeon’s handling of the affair.
Voters also started to make clear their dissatisfaction after a YouGov poll showed Sturgeon’s approval ratings had plummeted to negative territory.
However, during her speech Sturgeon said her decision to resign was “not a reaction to short-term pressures”.
“This decision comes from a deeper and longer-term assessment,” she said.
“I know it may seem sudden, but I have been wrestling with it, albeit with oscillating levels of intensity for some weeks.”
Alison Thewliss, the SNP MP for Glasgow Central and the party’s home affairs spokesperson, said she was “gutted” at news of Sturgeon’s impending resignation.
She tweeted: “Absolutely gutted about this. Nicola has been an incredible leader.”
SNP MP Stewart McDonald described Sturgeon as “the finest public servant of the devolution age”.
“Nicola Sturgeon is the finest public servant of the devolution age,” the MP for Glasgow South tweeted.
“Her public service, personal resilience and commitment to Scotland is unmatched, and she has served our party unlike anyone else. She will be an enormous loss as first minister and SNP leader. Thank you!”