As the EU referendum campaign gathers momentum, polls show the UK almost evenly divided on the merits of staying in and pulling out. In Scotland, however, the "stay" option is, at this stage, clearly in the lead. Leaders of all the parties in the Scottish Parliament have opted for staying in and only Ukip and a few Conservatives are for coming out. Civil society is divided but with a preponderance of voices for remaining. This opens some intriguing questions about what will happen after June 23 as the Scottish and European issues have become so deeply entwined. Almost all the possible scenarios seem set to increase tensions on the constitutional issue.

The first scenario is that all four nations of the UK vote to withdraw; this seems unlikely given the Scottish figures. The second is that England votes to come out and Scotland to stay in. The weight of English votes means that Scotland has to leave the EU against its will. This represents the material change of circumstances that the SNP has stated as a reason for a new independence referendum on the slogan of Scotland in Europe.

Some polls suggest that such a referendum could be won but it would be a hard sell. The issues of public finance and the currency that held it back in 2014 are even more acute now. The price of oil is down. Sharing the pound would be even more difficult than in 2014 if Scotland were within the EU, subject to one set of financial regulations and the UK outside, subject to another. The point of the independence in Europe strategy when it was adopted in the 1980s was that it lowered the cost of independence, guaranteeing open borders, guaranteed access to markets and free movement of labour with the UK as well as Europe. With Scotland in the EU and the UK out, there would be a hard border between Scotland and England. It is for this reason that SNP leaders have indicated that they prefer both the UK and Scotland to be inside the EU.

Even if Scotland is obliged to leave the EU along with England, matters will change. The Scotland Act of 1998 does not specify the powers of the Scottish Parliament, only those reserved to Westminster. Everything else goes either to Scotland or, in many cases, to Europe. If we leave the EU, many of the European powers would revert not to Westminster but to Holyrood. This includes large swathes of policy in relation agriculture, fisheries, environment, justice and home affairs, higher education and social policy. Scotland could then choose, in these fields, whether to align its policies more with London or with Brussels, so retaining a connection with Europe if not a role in European policy making.

The third is that Scotland votes decisively to stay in Europe and England votes by a small majority to leave, producing an overall majority to stay. In this case, England is held in the EU against its own wishes. We know that Brexiters in England are more likely to be English nationalists and this will enrage an English opinion already exercised about English Votes for English Laws and what they see as Scotland’s favourable financial position. England, unlike Scotland, does not have the option of withdrawing from the UK but opinion on the English Right might be increasingly tempted to achieve some of the same result by encouraging Scotland to leave.

The fourth is that all four nations of the UK vote to remain within the EU, avoiding a domestic constitutional crisis in the short term. In the longer term, however, the issue will continue to rankle. The deal David Cameron made in Brussels has been derided as small beer, not living up to the early promise of a radical change in the relationship with the EU. On the other hand, the whole episode has made it clear that the UK’s wholehearted engagement with the European project is at an end. At UK level, few of those supporting "remain" have questioned the direction in which the Prime Minister chose to travel, towards a looser union; few have called for the UK to resume leadership in Europe rather than stay at the margin. Few have supported freedom of movement as a matter of principle and expression of European citizenship rather than a burdensome obligation. The exemption Mr Cameron obtained from the principle of "ever closer union of the peoples of Europe" may look symbolic but it does mean that UK governments will henceforth pick and choose which bits of future agreements they will accept. The opt-out will be the norm rather than the exception. The requirement put in place by the Coalition Government that any new transfer of powers to the EU be subject to a referendum will make future governments even more cautious.

The question then arises as to whether Scotland would wish to travel in the same direction. There are distinct views here (and not just in the SNP) about the social dimension of Europe, freedom of movement, climate change and renewable and non-renewable energy. There are distinct interests in agriculture and fisheries. Some of these concern devolved matters, where Scotland would want its voice to be heard in the councils of the EU. Others are reserved. At present, Scotland has a say in EU policy making through the Joint Ministerial Committee on Europe and Scottish ministers participate in the UK delegation to the Council of the European Union. It does not participate in the European Council, which consists of heads of state and government. These arrangements give Scotland a voice but not a vote as the final word on the UK negotiating position rests with the UK Government. If differences between the two governments increase, the mechanisms could come under increasing strain.

Scotland is not the only player in the UK’s constitutional drama. Opinion in Wales seems to align more with England although both Welsh Labour and Plaid Cymru are firmly for remaining in the EU. In Northern Ireland, nationalist voters are massively for remaining while unionists appear equally divided. As the Republic of Ireland will stay in the EU irrespective of what the UK does, Brexit would create a hard EU border between the two parts of Ireland. It could also open fresh divisions between the two communities there and lead to calls for a poll on Irish unification.

In London, the Brexit debate is presented as one between the UK and the EEU. I am writing this from Dublin, where our EU debate is a leading news item. It is seen as a central issue for Ireland, for the future relationships of the peoples of these islands and for Europe as a whole. Our constitution is changing in multiple ways and neither the referendum of 2014 nor that of 2016 will prove to be the final word.

Michael Keating is Professor of Politics at the University of Aberdeen and Director of the Centre on Constitutional Change. He is senior fellow in the ESRC UK in a Changing Europe programme.