THE last time Nicola Sturgeon met Theresa May was in June, shortly after she had become Prime Minister. They got on well, we were told. As women at the summit of politics, they have a lot in common, and May was trying to present herself as a more down-to-earth leader than the Eton elitists she had replaced. What a difference 100 days makes.

Tomorrow's Brexit joint ministerial committee will be a very different affair from the Bute House honeymoon. No swapping anecdotes about political misogynists and the difficulties of getting civil servants to stop calling you Ma'am. The First Minister's ferocious attack on the “xenophobia” of the Tory conference will hang over tomorrow's Brexit joint ministerial meeting in Westminster like a dark cloud.

Back in June, the Prime Minister was insisting that Article 50, triggering the two-year EU withdrawal process, would not be declared until there was “an agreed UK position” involving all the devolved legislatures. But in case anyone thought that this meant the Scottish Parliament would be meaningfully involved, the Brexit Secretary, David Davis, made clear later that there could be no “veto”. The “agreed position” is whatever the UK Government defines as the meaning of Brexit, which currently means halting immigration and shunning the single market.

Ministers have also said there can be no special arrangements for different nations and regions because it has to be one Brexit for everyone. Except, that is, for the City of London, which needs to have privileged access to the single market. And of course there will be a different arrangement for Northern Ireland, and all those little places everyone forgets about like the Isle of Man. But the Scottish Government, we’re told, just has to accept reality, stop whining and get over it.

However, it is not just the Scottish Government that's whining. The publication last week of the referendum bill has concentrated minds in Scotland. The avowedly Unionist Daily Record ran an ambiguous front page with a referendum ballot paper and the claim that Theresa May was “pushing us that way”, suggesting that Scotland might be moving towards independence. The Scottish Greens are firmly behind the idea of holding a referendum if Scotland is out of the single market. The deputy leader of the Scottish Labour Party, Alex Rowley, endorsed the case for Holyrood to have powers over trade and immigration. He also called for a new constitutional convention to press for a “special deal” for Scotland. Scotland may not be ready for an early referendum, but it is firmly behind the First Minister’s demands.

But we’re told that Theresa May has other things on her mind right now as she is cold-shouldered in Brussels and as she loses the battle to exclude the UK Parliament from a vote on Brexit. Public opinion is changing fast in England as the economic problems become apparent. There is still no coherent plan for leaving the EU, and any latitude given to Scotland may only increase the impression that the Government is making it up as it goes along.

So, this may well be the moment at which historians judge that the United Kingdom finally unravelled. The First Minister is going in with a very tough agenda. She wants controls on immigration to be devolved to Scotland, the right to negotiate separate trade deals with Brussels and the right to remain, effectively, in the single market. On the face of it these demands have no chance of being accepted, given the UK Government's Brexit dogmatism. But it may not be as simple as that. Last week, the Financial Times argued that it was possible for Scotland to remain in the European Free Trade Area (EFTA) along with Norway and Iceland. Being part of EFTA (or the parallel European Economic Area) does not require membership of the EU customs union. A free trade area is different from a customs union in that the latter requires that common tariffs are applied by all member states. What this means, argued the FT, is that there need not be a so-called “hard border” between Scotland and England.

The UK Government has already made clear that it favours a continuation of free movement of people and goods over the border between Northern Ireland and the Republic. It's called the Common Travel Area, and both sides of the Irish divide agree that abolishing it could provoke a revival of the Northern Ireland troubles. It would certainly undermine the 1998 Good Friday peace agreement, which was endorsed by referendums on both sides of the border.

Many believe that the UK Government will reject any attempt to replicate this arrangement for Scotland. But that would send a very troubling message to Scots. It would be saying, in effect, that there can only be special arrangements when there is a fear of actual violence. Scotland has always stuck to peaceful means of advancing towards constitutional change, and no-one wants that to change. As for immigration, the Common Travel Area again provides a precedent for managing immigration without hard borders. But it isn't clear that immigration really is a red line for the UK Government. Before the referendum, the former Tory Lord Chancellor, and leading Brexiteer Michael Gove, said that Scotland should get immigration powers after Brexit. Asked about this last week, the UK Brexit minister, David Jones, said there would “be discussions about where the powers should lie”.

The City of London is angling for a system of regional visas based on the American and Canadian systems, which allows exemptions from overall immigration policies to deal with specific skill shortages in sparsely populated areas. If that applies to over-populated London, it must surely also apply to Scotland. The City, moreover, is determined also to remain in the single market as far as finance is concerned, and it wants to emulate Switzerland, which is not in the EU but accepts EU financial regulations so that it can do business within it.

So the First Minister has every chance of achieving a “bespoke arrangement” for Scotland, and this is something that all parties in Holyrood can support, if they have any sense. For this is not an independence project. The First Minister has made clear that the “option” of independence will only be explored if her negotiations with the UK fail to deliver. Nicola Sturgeon told the SNP conference a week ago that she wanted a “coalition” with progressive parties against hard Brexit. That was a pretty remarkable suggestion since it implies working with Labour and the Liberal Democrats, the Nationalists' bitter enemies.

So, these negotiations are a considerable political risk for the First Minister – if she wins she risks undermining the case for an early repeat referendum. Cynics might say, and they do, that hard Brexit is the best outcome for the SNP because it will demonstrate that there is no future in the UK. It is a risk the First Minister is prepared to take, however, to demonstrate to the Scottish people that she is sincere in putting Scotland's interests before party advantage. She understands instinctively that Scottish voters like to see their parties working together, and that they will only support independence once they are sure that all options have been explored.

So, Labour and the LibDems have every reason to set tribalism aside and follow the First Minister's lead. Indeed, if the venture succeeds, they could say that they have saved Scotland from indyref 2.