The idealist remade herself as a leader with heart but is now locked in a ferocious struggle over a second referendum

Within 48 hours of becoming prime minister in July last year, Theresa May flew to Edinburgh to meet Scotland’s first minister Nicola Sturgeon for the first time.

Although differences between the two over Brexit and a second Scottish independence referendum were aired, they seemed to get on, relishing the image of two women at the top of their respective governments, a welcome change from male dominance, a chance at last for a more cautious, rational, grown-up approach to politics.

The two were pictured together smiling outside Bute House, official residence of the first minister. Sturgeon, an inveterate tweeter, sent out a message afterwards: “Politics aside – I hope girls everywhere look at this photograph and believe nothing should be off limits for them.”

Eight months on, the relationship is, if not hellish, then close to it. Sturgeon finds meetings with May hard work, strained and stilted, with the prime minister unwilling to engage in anything resembling a normal conversation. May sticks rigidly to a script, repeating the same line over and over. Less than a year after tweeting triumphantly about that picture, Sturgeon offers up a damning assessment in private: she would rather still be dealing with May’s predecessor, David Cameron.

Both May and Sturgeon are taking a huge personal gamble over a second Scottish referendum. Alex Salmond resigned as Scotland’s first minister in 2014 when he lost the first one and two years later Cameron resigned after losing the Brexit vote. Only one winner can emerge from the May-Sturgeon stand-off. Unsurprisingly, few, if any, attending a Scottish National Party conference in Aberdeen to hear Sturgeon deliver a rallying call on Saturday expect the winner will be May. “I do not know Theresa May as well as I know Nicola. But I have no doubt Nicola not only has the shrewdest but also the cleverest mind. And she is good at taking people with her,” said Mike Russell, the Scottish cabinet minister responsible for Brexit.

If it was just a matter of a clash of personalities, it might not matter much who wins. But this is about the future of the union. If May wins, the union remains intact. If Sturgeon wins, Scotland becomes independent and the union is left as a rump made up of England, Wales and Northern Ireland.

Sturgeon, 46, was born in Irvine, on the Ayrshire coast, brought up in a council house, her mother a dental nurse, her father an electrician. She went to state schools and then to Glasgow university to study law. Afterwards, she worked in at a law centre in one of Glasgow’s large council estates, helping people facing eviction or problems with welfare payments.

She said her first stirrings of interest in politics came as a child when she heard her parents, who supported the SNP, discussing the failed 1979 referendum on devolution. She joined the SNP at 16, at a time when the party was on the margins of Scottish politics. One of her teachers, a Labour supporter, had assumed that she, like other working-class youngsters interested in politics, would join Labour but, according to Sturgeon’s version, she opted instead for the nationalists just to be contrary.

From early on she was talked about in SNP circles as a future leader. She has been in the Scottish parliament since 1999 when she contested Glasgow Govan. Five years later, Salmond stitched up the party leadership contest, making Sturgeon his deputy. In 2007, she became deputy first minister and in 2014 first minister.

When she was younger, she had a reputation as a “nippy sweetie”, a Scottish description of someone argumentative, sharp-tongued. Those who know her attribute this to shyness and say she softened as she grew in confidence. David Torrance, who wrote an unauthorised biography Nicola Sturgeon: A Political Life, said there was a conscious change in her political approach and image, what the journalist Euan McColm dubbed “Project Nicola”, in the years after she became deputy party leader in 2004.

The “nippy sweetie” reputation reflected her lack of concern about her image, a refusal to be clubbable or to make small talk with journalists or conform to mainly masculine expectations of what a female politician ought to be. But after becoming deputy leader she conducted a personal audit, reviewing her image, public persona and approach to the media. “At one point she told a journalist she hadn’t come into politics to talk about shoes, but a year later she was giving a feature writer a tour of her wardrobe and collection of footwear. Her view seemed to be, ‘There is a media and public appetite for this sort of thing and I have little choice politically but to satisfy that’,” Torrance said.

Her elevation to first minister brought her to the attention of the rest of the UK, especially during the 2015 general election when she starred in debates with other party leaders. Her popularity soared in Scotland. On a helicopter tour as part of a campaign, there were emotional scenes, with women bringing daughters to have selfies taken with her. Nicola-mania has since died down but she remains popular.

She never seemed to become carried away by the mania, remaining relatively unassuming. Minutes after delivering an important speech at an SNP rally in Perth, she was approached by a journalist asking if she had the mobile number of a party colleague. She rummaged about in her bag for minutes looking for a phone or contacts book, only stopping when an irritated party official intervened to tell the reporter to ask a press officer instead.

Scottish artist Gerard Burns, whose work hangs in the National Portrait Gallery in Edinburgh, painted Sturgeon in 2015. Burns, who was attending this weekend’s SNP conference, is a former Labour supporter who switched to the SNP after the independence referendum. He said he believes his portrait of her standing in Bute House gets to the essence of her personality. “It is a gallus pose, with a bit of attitude, a little bit of mischief. She does not look pompous. She looks self-assured and – here is a risky word – she looks feminine. If people ask me what she is like, I would say quite shy,” Burns said. Sturgeon’s friends said that even when she was younger she would prefer to sit with a book than go dancing, but she still went out for nights on the town. One, Anne McLaughlin, SNP MP for Glasgow North East, said the first minister has a wicked sense of humour and the two often had laughs when they went out together. “She split her jeans one night on a buckin’ bronco,” McLaughlin said. “She was an elected politician at the time. She could have gone home but she stayed. I just had to make sure I was always covering her.”

Those kind of nights ended when she married Peter Murrell, the SNP chief executive, in 2010. She revealed last year that she had had a miscarriage in 2011, only making the disclosure because she wanted to “challenge some of the assumptions and judgments that are still made about women – especially in politics – who don’t have children”.

Sturgeon portrays herself as on the left, which infuriates Labour, who point to statistics on health and education over the last ten years the SNP has been in power and suggest it is harder now for anyone from a working-class background to make it to university, as Sturgeon did. “She likes to think of herself as left wing, but if you look at what she does instead of what she says, the approach is almost Blairite. She is pragmatic; the philosophy is, ‘Whatever works’,” Torrance said.

“There is also something of the early ’90s Glasgow university student politician about Sturgeon, still clinging to the notion that she’s idealistic and unsullied by compromise, when in fact from the moment she was elected, and certainly from the moment she became a minister and later party leader, she started to shift.

“You can’t be an idealist in government. You have to make necessary accommodations with the uncomfortable realities of modern politics.”

Tommy Sheppard, comedy club founder and SNP MP for Edinburgh East, had been Labour assistant general secretary in Scotland under John Smith but became disillusioned with Labour. He puts Sturgeon in a different league from the last few Scottish Labour leaders: Jim Murphy, Johann Lamont and Iain Gray. “I think she is in the same league as Dewar,” he said. That is quite an accolade: Donald Dewar, Scottish secretary in Tony Blair’s first government, is venerated in Scotland as a politician of rare stature.

Dewar campaigned for and delivered the Scottish parliament. To stand comparison, Sturgeon will have to defeat May and deliver independence.

The Sturgeon file

Born Nicola Ferguson Sturgeon on 19 July 1970 in Irvine, Ayrshire.

Best of times Becoming Scotland’s first minister in November 2014.

Worst of times The Scottish people’s rejection of independence in the referendum held earlier that year.

What she says As a teenager, she had a reputation for seriousness. The comedian Rory Bremner asked her what advice she, as first minister, would have given to her teenage self. She replied: “Lighten up … and then the girl of 16 would say eff off.”

What others say Forbes last year added her to its list of the world’s most powerful women, second highest in the UK behind the Queen (before Theresa May became PM).