It's tight, incredibly tight.

The assumption that all would be well, that a clear majority of people would "see sense" at the eleventh hour and vote 'Remain' has proved over-optimistic.

It may still be that, when the final results come in, the UK has voted to stay within the EU but the Leave side has clearly suffered a massive setback.The blame game has already started. Labour is at fault for not getting its voters out. The SNP haven't done enough with theirs. The Tories started it, they called the referendum because their party is split on Europe. Etc, etc, etc.

All of the above have some truth in them though, as a matter of straight fact, this was a referendum called by David Cameron, though he would say after a manifesto promise to do so.

But let us assume that - as seems at least possible now - the Leave side has won, albeit closely.

What does that mean? Well, first if you are a voter in Dumfries, or Moffat, or Galashiels, or Eyemouth and changed your mind to vote Leave you have helped change the course of UK history.

Credit: Reuters

In its manifesto for the recent Holyrood election the SNP put it thus:

"We believe that the Scottish Parliament should have the right to hold another referendum if there is clear and sustained evidence that independence has become the preferred option of a majority of the Scottish people – or if there is a significant and material change in the circumstances that prevailed in 2014, such as Scotland being taken out of the EU against our will."

Even at this early stage, it seems clear Scotland is voting by a healthy majority to remain in the EU.

So, if it is a Remain vote in Scotland and a Leave vote overall in the UK, First Minister Nicola Sturgeon will be under huge pressure to press ahead with this SNP manifesto commitment.

But this in itself is fraught with difficulty. There are many in the SNP who, frankly, think this would a disaster for them and their ultimate objective of Scottish independence.

Trying to win a second referendum while there is uncertainty over the UK negotiations on leaving the EU would, they believe, be very, very difficult.

Scotland would be trying to join a club that the rest of the UK would be trying to leave.

And then there is the major unresolved issue that the constitution is still a matter for Westminster. Could the SNP even call a referendum legally?Others in the SNP though take a more gung ho approach. They will relish the prospect of a UK government in turmoil. What better a backdrop for indyref2, they will think.

To use words once uttered by former Scottish Labour leader Wendy Alexander of a Scottish referendum, the attitude from these SNP optimists would be "bring it on".

Now if it comes to it and the overall UK result is 'Remain' even if it is by a narrow majority, then none of this will apply.

But it's worth considering. Very carefully. I'm sure Ms Sturgeon will be doing so right now. And probably hoping that she won't have to deal with that scenario.