KEZIA Dugdale’s two years in charge of Scottish Labour were turbulent from start to finish.

After being mentored at Holyrood by Labour veteran George Foulkes, she replaced him as a Lothians list MSP in 2011, already tipped as a rising star.

Less partisan than many colleagues, she openly cited Nicola Sturgeon as an inspiration - not a popular view given the SNP had just won a landslide majority.

But the SNP’s unprecedented win, after Labour thought it was about to resume control of parliament after the “blip” of 2007, plunged Ms Dugdale’s party into turmoil.

Iain Gray, who would become one of her closest allies, quit and was replaced by Johann Lamont, who in turn resigned in 2014 complaining about UK Labour under Ed Miliband treating the Scottish operation as a “branch office”.

Jim Murphy then became leader with Ms Dugdale as his deputy.

With Mr Murphy in Westminster, Ms Dugdale got a bruising taste of front line politics, facing Ms Sturgeon as FMQs, where her inspiration often proved her nemesis.

Barely six months later, the SNP tsunami of 2015 swept away Mr Murphy and 39 other Scottish Labour MPs and Ms Dugdale became leader in her first term as an MSP.

She was keenly aware of the fragility of her position: she had her MSPs sign a pledge they wouldn’t challenge her, so she could enact a long-term plan to revive the party’s fortunes.

It didn’t work. Unlike her Tory counterpart, Ruth Davidson, who also had a rocky start as leader but had the time to grow into the job, Ms Dugdale faced election after election.

She took Labour into third place at Holyrood in 2016, and the briefing against her started.

Then she chose Owen Smith over Jeremy Corbyn for UK leader, and said the latter was not competent to fill the job, and the briefing ramped up even more.

One member of Labour’s ruling Scottish Executive Committee (SEC) said the endorsement showed one of Ms Dugdale’s “most endearing qualities”, but also terrible strategy.

“Owen was a long term friend. It was down to loyalty. She would have been better to stay above it all, but she came out for her friend. It was her biggest political error.”

The decision meant Ms Dugdale was seen as forever out of synch with the Corbyn project.

The strains in her private life also became more pronounced.

In 2014, her closest friend, Gordon Aikman, was diagnosed with motor neurone disease.

His rapid decline and death in early 2016 profoundly affected her, and she became more reflective and philosophical, talking about what was important in life and whether she wanted to be a politician in the long term. She said she might write crime fiction after Holyrood.

“She never wanted to be a politician forever and a day,” said a colleague.

Around the same time, she also revealed publicly that she was in a long term gay relationship, and soon announced her engagement to Louise Riddell.

That also didn’t last, as she fell for SNP MSP Jenny Gilruth and broke up with her fiancee.

The two elections of 2017 brought yet more turbulence.

In May’s local vote, Labour came third behind the Tories, and lost Glasgow to the SNP.

And while the party gained six MPs in June, the credit went to Mr Corbyn, not her.

It was especially galling given the Scottish party had felt underfunded by UK Labour, and was reduced to targeting around a dozen seats simply through a lack of cash.

“The fact we got so close in other seats was really down to the sheer force of campaigning on the ground,” said one senior source.

However one Labour MSP said that while the Corbyn message had gone down well on the doorstep, Ms Dugdale’s message had been “confused” and “negative”.

After the election, there was more grumbling from the Left about her performance. The Scottish Left Review stepped up its calls for her to quit.

“Over the last nine months there has been a lot of a low level destabilisation from certain quarters,” said one MSP.

“People thought [MSP] Neil Findlay’s book [about Scottish labour] was a stalking horse move, helping to carve out a path for someone else to take over.

Suspecting Ms Dugdale’s deputy, Alex Rowley of stirring, Lord Foulkes confronted him.

“I got reports that he was on manoeuvres, but he assured me that he was supportive, and that he would never challenge her,” he said.

“He gave me an assurance a few weeks ago - I had to take it at face value.”

Although Corbyn supporters were certainly making noises off, there was no coup.

The accumulation of personal issues, the prospect of more years of thankless grind and the risk of burn-out had finally persuaded her it was time to move on.

Last week, after brooding on the issue over the summer, Ms Dugdale appeared notably downbeat as she returned to the limelight to accompany Mr Corbyn on his Scottish tour.

The 36-year-old had made up her mind to go.

“She had made peace with Corbyn, there was no way she was shoved out,” said a friend. “It’s all on her own terms and her decision.”

Over the weekend she spoke to Mr Gray to tell him she was quitting.

He tried to dissuade her, saying the party was in a far stronger place because of her and that some of that could be undone by her going, but she was determined.

Her departure was almost as messy as Mr Murphy’s in 2015, albeit far quicker.

SEC members were told around lunchtime on Tuesday, as was BBC Scotland’s Political Editor Brian Taylor. Under conditions of strict secrecy, a hotel room was booked at Edinburgh’s Balmoral Hotel for 6pm for Ms Dugdale’s resignation TV interview.

Key aides and advisors were told via email - but too late to argue for a change of mind.

Ms Dugdale’s chief spin doctor Alan Roden, former political editor of the Scottish Daily Mail, was only informed at short notice while on holiday in America.

It was not until 10pm on Tuesday that many MSPs learned the news via a message on social media - a restricted WhatsApp group used to communicate party business in private.

The decision to keep the information secret left the party machine scrambling to react.

“It was a bolt out of the blue for all of us,” said one source.

“I don’t know what lies behind it, but it is the kind of job that grinds you down.”

Another suggested that, after the failure of one relationship, Ms Dugdale had decided to put her relationship with Ms Gilruth first in case it too suffered from the strains of the job.

Many Labour MSPs said they were “shocked” at the news, but in hindsight not surprised.

One said: “It’s been pretty tough being Scottish Labour leader over the last two years. Kez found it difficult. She likes to be self-sufficient, and it’s been a lot of weight on two shoulders.

“She was also very close to Gordon. That did affect her. She was also having a lot of personal difficulties in her relationships. It all added up, and she’s quite thin skinned.”

Another senior Labour source said Ms Dugdale saw that if she didn’t get out now, she could be committing herself to a decade as leader.

“If she stayed to the 2021 Holyrood election and Labour did well, then there’s no reason for her to stand down. So she’d have to stay until the election in 2025, 2026.

“You’re talking about 10 years. Given the nature of Scottish politics that’s pretty hard going, particularly for someone who does not enjoy the angst that goes with the job.

“It’s pretty draining unless you’re really thick skinned, and she’s not that thick skinned."

It’s relentless. The day-to-day grind, the grief from the Cybernats and all of that s***e.

“Her sexuality gets dragged up online and it’s really nasty and unpleasant.

“It’s not a state of affairs that a normal human being enjoys. You can put up with it, but it’s not enjoyable. She must have thought, why am I doing this? Do I want to be doing this for the next 10 years of my life, so I end up in my mid-40s unable to do anything else?”