Nicola Sturgeon has thrown down the gauntlet to Boris Johnson over a second independence referendum, telling Sky News that if the UK government doesn’t challenge the Scottish government in court, then “by definition it would be a legal referendum”.

Scotland’s first minister, who will claim the right to hold a second independence referendum by the end of 2024 should the SNP win a majority in the Scottish elections this week, said Mr Johnson was “not entitled to stand in the way of the democratic choices of the people of Scotland” and would have to take the Scottish government to court to stop her second referendum.

“I’m saying if Boris Johnson wants to stop it, he would have to take legal action,” she said in an interview in Glasgow last month.

“If Boris Johnson didn’t do that [take legal action to dispute the legal basis of the referendum], by definition it would be a legal referendum. If he did do that, the courts would decide.

“But actually, we’re getting ahead of ourselves here because I believe that if the people of Scotland vote for this, if the support for independence continues, then it is not sustainable for any Westminster prime minister to stand in the way.”

Mr Johnson has insisted he will refuse any request for a second independence referendum, saying the matter was settled for a generation in 2014, while the Scottish Conservative leader Douglas Ross has said a referendum held without the approval of Westminster would be “illegal”.

Ms Sturgeon’s assertion that a second referendum would be legal if it is not challenged by the UK government has raised eyebrows in Westminster.

More from Boris Johnson

“The Scotland Act requires consent for a referendum. Just because it’s not challenged by the UK government doesn’t make it legal,” said one Conservative source. “The argument she is deploying is a significant development.”

The UK government is clear that the UK’s constitution is reserved for the Westminster parliament. Ahead of the 2014 referendum, the two governments signed the Edinburgh Agreement. This time around Ms Sturgeon is pressing ahead regardless of the UK government’s wishes.

However, in reality the UK government might have little option but to go to court to block a second referendum, sources in Westminster concede.

Under the devolution settlement, if legislation passed in Holyrood goes beyond the scope of the devolved administration’s power, the UK government has four weeks to decide whether to challenge it in the Supreme Court, which makes it almost inevitable that the UK government will have to go to court to strike down the legislation

Alister Jack, the Scotland secretary, said in March that the UK would be prepared to take Holyrood to court to overturn a second referendum, while Mr Johnson is also reported to be privately saying the same.

The 2014 referendum was held with consent of the UK government, with Westminster and Holyrood agreeing the terms of that referendum in the 2012 Edinburgh Agreement.

But this time around, Ms Sturgeon will press ahead with plans to hold a second referendum unilaterally should the Scottish elections this week return a pro-independence majority to Holyrood.

Polling suggests that the SNP is heading for an outright majority, or at the very least a pro-independence majority with the backing of the Greens.

Under a ‘Road to Referendum’ blueprint published by the SNP Scottish government in January, Ms Sturgeon intends to pass a referendum bill after the pandemic is over and then demand Mr Johnson agree to a Section 30 order that paves the way for a second referendum. If the prime minister refuses, Ms Sturgeon will press on regardless.

“The UK government is already considering what they do in these circumstances because they can’t stand in the way of a clear democratic demand of the Scottish people,” Ms Sturgeon told Sky News. “That’s why the UK government is talking about trying to rig the question and rig the franchise.”

“Boris Johnson is not somebody that is immune to democracy,” added the SNP leader.

“This argument that people in Scotland can vote for that, that they can demand a referendum, they can vote for the SNP over and over again, but somehow a Westminster prime minister can simply stand in its way, it’s not going to be sustainable, but it also, in the process, perhaps makes the biggest argument for independence there is.”

A senior SNP figure told Sky News they believed the UK government would eventually agree to another referendum.

“I think in the end they will do it by agreement because there’s no clearer way to drive people away from the union than by forcing them to remain in it via the courts,” they said.

The UK government thinks it would win in the courts, but it also knows the political fall-out could be damaging.

“You can see it now, how Ms Sturgeon would frame it, the courts in Westminster are overruling the will of the Scottish people,” said one Conservative source.

Government insiders are watching the Scotland results with trepidation, aware that the likely SNP victory is going to put the matter of a referendum and the future of the union front and centre in British politics once more.

“We can’t just ignore it. We have got to try to shut it down. It’s going to dominate our politics and I’m viewing it with dread,” said one Conservative source.

Polling over the past year has indicated majority support for independence, but in recent polls support has been dropping, with a clutch pretty evenly split between yes and no.

Last week, the Scotsman released a poll which put support for yes at just 42%, the lowest figure in favour of separation since December 2019. The Savanta Comres survey found 49% of those polled would support staying in the UK.

A UK government spokesperson told Sky News that pushing for a “divisive referendum” was “simply irresponsible”.

“It is a distraction, when we need to focus on continuing to tackle the pandemic and rebuilding our economy,” they said.

“Now more than ever, people in Scotland want to see the UK government and the devolved administrations working together to protect lives and livelihoods.

“The United Kingdom is the most successful political and economic union the world has ever seen, and this pandemic and our collective response, from the furlough scheme to vaccine procurement and the backing of our military personnel, has shown that we are at our strongest when we work together towards a common goal.”