Read her lips: “I am determined that Scotland will have the ability to reconsider the option of independence before the UK leaves the EU.” That was the passage from Nicola Sturgeon's first speech to the SNP conference that made the headlines and aroused the 3000 odd activists at the SNP conference to a pitch of ecstasy. Of course, she added - “if that is necessary to protect Scotland's interests”. So this wasn't quite the declaration of independence that some thought they heard. But that doesn't mean they were empty words.

The First Minister was first of all trying to put pressure on Theresa May over so called “hard” Brexit. Nicola Sturgeon is refusing to accept either that leaving the single market is a fait accompli, or that Scotland could not get a special side deal to remain in the customs union. In negotiations that begin a week tomorrow with the first meeting in London of the joint ministerial committee on Brexit, the First Minister will be arguing on three distinct levels.

First, she is calling for a “coalition against hard Brexit” in the House of Commons with Labour, Liberal Democrat and moderate Tory MPs to force a vote on Article 50 which kicks off the Brexit process. Last week, MPs belatedly began to get their act together on opposing Theresa May's attempt to push through hard Brexit under pre-democratic royal prerogative powers which bypass parliament.

If parliament does get a vote the First Minister believes a majority of MPs would vote to remain in the single market (ESM). She insists that Brexit does not automatically mean leaving it, and she quotes ministers like Boris Johnson during the referendum campaign saying that Britain would remain in the ESM. If the Commons fails to win a vote on Article 50 the fight goes on to mobilise opposition to the Great Repeal Bill on the grounds that parliament did not authorise hard Brexit and any such deal is illegitimate.

However, Westminster isn't the only parliamentary terrain upon which the First Minister is marshalling her troops. Almost as important in her speech was the passage where she said that denying Holyrood a legislative consent motion on Brexit would amount to “constitutional vandalism”. She pointed out that the Sewel Convention, under which Holyrood gets to agree on any measures of the UK parliament that impinge on the powers of the Scottish parliament, had been put on a statutory basis by the 2016 Scotland Act.

Number Ten has tried to claim that Holyrood has no right to a say because leaving the EU is a constitutional matter which is reserved to Westminster. Also, since all the powers repatriated from Brussels over workers rights, environment etc will remain on the statue book - for the time being at least - after the 1972 European Communities Act is repealed, nothing has actually changed Holyrood’s specific powers. This should be opposed by all Scotland's parties.

If Holyrood allows itself to be excluded then it may be left to the UK government alone to decide which repatriated powers should remain on the statute book in future. Indeed, it sounds as if Number 10 expects to go through the thousands of regulations and directives issued by Brussels since 1973 and decide, by executive fiat, which are retained and which aren’t. This will be announced in subordinate legislation, by decree.

This isn't just about bent bananas. Environmental law has largely been determined by Europe, on everything from air pollution to the quality of bathing water at Scottish beaches. Genetically modified crops are also tightly controlled under EU legislation. These are areas that directly affect the Scottish parliament's competence and the quality of life of Scottish voters. Holyrood must get its oar in early here and demand a say.

But there is another aspect to this, which brings us onto the third level on which the First Minister is negotiating: more powers as a result of Brexit. Even as Sturgeon fights against EU powers being removed, she will also be arguing for Holyrood's powers to be increased. As the Unionist academic, Professor Jim Gallagher pointed out last week, powers over agriculture and fisheries should automatically fall to the Scottish parliament after Brexit. But the First Minister is looking beyond these to what she calls “substantial additional powers for the Scottish parliament” including “powers to strike our own international deals”.

During the referendum campaign the former Lord Chancellor, Michael Gove, said that Holyrood could win control of immigration policy after Brexit. There is also the possibility of new tax powers for Holyrood. When Brussels no longer receives VAT payments should that not fully devolve to the Scottish parliament? And now that the proposals for a common EU regime on corporation tax is abandoned could there be a case for the Scottish parliament to have that too?

Sturgeon firmly believes that Scotland could have its own post-Brexit relationship with Europe even while remaining part of the UK. Not just Greenland, but many remote areas have special relationships with Brussels, including territories out of the EU, like the Faroes, and in it like the Finnish Aland Islands. UK territories and dependencies like Gibralter, the Isle of Man, the Channel Islands and Northern Ireland also have unconventional relations with the EU, often involving “derogations” on matters like free movement.

Strictly speaking, the Isle of Man is not part of the UK, and it is not part of the EU either, but it is in the EU customs union. Northern Ireland will almost certainly have a special status after Brexit to avoid a hard border with the Republic. This is likely to mean the north retaining free movement, joint citizenship and free cross border trade. Sturgeon believes that these precedents will show that it is possible for Scotland's parliament to have a bespoke deal with Brussels. This is a hugely complex area and Brussels may have other things on its mind right now than inventing special relationships for Scotland. But the First Minister is surely right in not giving up on the possibility at least of keeping Scotland in the EU customs union.

So, in a very real sense the First Minister is trying to get the best out of Brexit even while opposing it. She is searching for a better devolution settlement even as she threatens a referendum on independence if Scotland is pulled out of the single market. Some have assumed that this means she isn't serious about holding another referendum, and it is true that she wins a special deal then it would be difficult to justify an independence vote on top of that. But this doesn't mean she won't call one if the negotiations fail, as they are likely to given Theresa May's hard line.

Indeed in an interview with BBC's Brian Taylor the First Minister more or less committed herself to precisely this. In a webcast after her Friday speech she said that if Brexit means Brexit on Downing Street's terms, she would regard it as a “duty” to give the people of Scotland “the right to choose something different.” If her multi-layer negotiations do not bear fruit it will be very difficult for the First Minister not to honour that promise to stage indyref2 before Brexit Day in 2019. The question then will be: will she get permission from the UK Prime Minister to hold it.