Scotland's First Minister Nicola Sturgeon addresses the audience at the Residence Palace in Brussels on June 2, 2015. Virginia Mayo /Press Association. All rights reserved.As the UK descends into extraordinary political and economic chaos, with no political leadership visible anywhere in Westminster, what are the options for Scotland to stay in the European Union or at least as integrated with it as possible?

Nicola Sturgeon – the only UK political leader who appears to have done serious contingency planning for a Brexit vote – has put the option of an independence referendum on the table, which she says would need to happen before the UK pulled out of the EU.

Yet many are also asking whether there are other ways Scotland could remain integrated with the EU, even if England and Wales – with or without Northern Ireland – detach from Europe.

The choices open to Scotland on the EU will depend on whether – and when – Scotland votes for independence in a second referendum.

If Scotland stays part of the UK, then Scotland’s choices on its EU relationship will depend, to some extent, on what sort of relationship the rest of the UK negotiates with the EU. On Monday, Boris Johnson seemed to be backpedalling madly – suggesting the UK will stay closely integrated with the EU. If it did, that would make it easier for Scotland.

But if the UK ended up with a Canada-style free trade deal, there may be ways for Scotland to stay more integrated with the EU than that.

(1) If Scotland goes for independence:

Becoming an EU member state should, in essence, be straightforward. Scotland already meets all EU economic and political criteria for membership, has MEPs in the European Parliament, participates in EU regional, education, research and cultural programmes, and meets almost all the EU’s ‘acquis’ of laws and regulations – except for those where the UK has opted-out.

There will be two main challenges for an independent Scotland in becoming an EU member state in its own right:

(i) Negotiating with the EU

Scotland will need to negotiate with the EU around the UK’s opt-outs. The UK has opt-outs from the euro and from Schengen, and an opt-in deal on justice and home affairs, plus a significant budget rebate.

The chances are that the EU would not accept an opt-out for Scotland from the euro, so Scotland would need to commit to join – but like Sweden or Poland, it would find that it could delay joining indefinitely, especially if it did not meet the criteria for joining.

Like Ireland, Scotland would probably quite easily get an opt-out from the border-free Schengen zone. But it would be expected to sign up fully to the justice and home affairs rules, and is unlikely to get a continuation of the budget rebate deal.

(ii) EU Politics of Scotland becoming an independent member state

The politics of joining will be easier than in 2014. In the first few days since the Brexit vote, several EU political figures have spoken positively about Scotland staying in the EU.

Where, in 2014, EU leaders were keen to discourage the break-up of a member state, the possibility of welcoming in one pro-European part of the UK, when the EU’s cohesion and attractiveness has been weakened by the Brexit vote, is now a plus. For Brussels, Scotland has become the good Europeans, England and Wales the bad.

Ireland’s Fianna Fail leader already said, if Scotland votes for independence its EU membership should be fast-tracked.

Rather than scare-mongering over how long Scotland could take to join, Brussels now should be clear that talks on the conditions of joining could take place in months not years – though inevitably ratifying an accession treaty across 27 member states will take at least two years if not longer.

There will need to be some pragmatic discussions on how Scotland could stay in the EU on a transitional basis – without a vote in the Council of Ministers – while ratification takes place. This is in fact what would very likely have happened if Scotland had voted for independence in 2014.

There will still be tricky politics, not least due to Spain’s deep concerns over Catalonia’s push for independence, at a time when Spain’s own politics is in some disarray with the repeat general election held on Sunday resolving none of the political stalemate there.

But Spain is not in the same position as the UK, despite its political challenges – it is not facing any likelihood of leaving the EU. So at least Scotland, and its supporters in other EU member states, will be able to say to Spain that the circumstances in which Scotland is becoming independent, and joining the EU, are not those faced by Spain.

Timing will be important – the UK might leave the EU before an independent Scotland could join

Amidst the current chaos, the EU is said to have pencilled in January 2019 for the UK’s exit from the EU – this assumes the UK will have activated the EU’s exit clause, Article 50, by the end of the year.

If there is a second independence referendum, unless it is held in the next six to twelve months, then it is unlikely Scotland could both vote for independence and complete talks over the terms of the divorce with the rest of the UK (rUK) before the UK leaves the EU. In the 2014 White Paper on Scotland’s Future, the SNP government said these talks could be completed in 18 months.

The UK’s talks with the EU could be extended beyond the two year deadline set out in the Lisbon Treaty – but that is up to the other 27 EU member states and they are signalling clearly their wish for the UK to go quickly.

So the UK could be out of the EU, before Scotland is an independent state separate from the UK.

But as long as Scotland has held a successful independence referendum before the UK leaves, then talks with both Westminster and Brussels would have to take this new political reality into account and establish transitional procedures accordingly. There will be no point in Scotland repealing EU laws only to pass them again a few years later. It will be tricky but not impossible.

If Scotland held an independence referendum by mid-2017 – and the vote was ‘yes’ – then it could probably complete talks with London by the end of 2018 and, in parallel, hold talks with Brussels on its accession deals within that time period too. Given Scotland is already part of the EU, there is no reason that talks should need more than a few months.

But still, since ratification of an accession treaty would take two years or more, by the start of 2019, an independent Scotland would risk being outside of the EU for a few years. This is undesirable but not disastrous.

Brussels should be able to find a transitional status for Scotland so it is essentially within the EU still – with all rights and responsibilities – but without a vote or place in the Council of Minister and European Parliament until its accession treaty is ratified.

Relations with rUK

Once Scotland is in the EU and rUK outside, how the two countries interact will depend on the sort of deal rUK sets up with the EU. If this full rUK-EU deal takes several years – so the UK exits within the two year deadline but doesn’t complete all talks on future relations – the ironic possibility would arise that Scotland, as an EU member state, would actually have a vote on that deal.

If rUK ended up in the European Economic Area (with Norway, Iceland and Lichtenstein), this would make Scotland-rUK relations the most straightforward as both would still be part of the Single Market. This would entail rUK accepting free movement still.

The EU’s external border would at this point run between Scotland and rUK (and between the Republic of Ireland and Northern Ireland).

If rUK negotiates some sort of Canada-style free trade deal that covers goods not services, and doesn’t include free movement, then border controls and customs will be more important between Scotland and rUK.

(2) If Scotland stays part of the UK

If Scotland remains part of the UK and so leaves the EU with the rest of the UK perhaps by the start of 2019, the question arises as to whether Scotland could nonetheless have some intermediate status, staying more integrated with the rest of the EU than the UK.

Whether this is even a relevant question will depend strongly on what sort of deal the UK decides to go for. If the UK chooses the EEA route – membership of the Single Market including free movement but not part of the customs union or common trade policy nor common foreign policy – then this may be sufficient for Scotland too.

Leaving the EU only to join the EEA would be perverse in many ways – the UK would still have to follow Single Market rules and laws but would have no voice or vote in determining them. Yet it could well happen.

If the UK decides instead to go for a Canada-style free trade deal, this is when Scotland could and should look at a differentiated approach.

Could Scotland for instance be effectively in the EEA while rUK had a free trade deal with the EU? There are precedents – not only in the currently much-cited Greenland case but with Cyprus, and in the past with the reunification of Germany – for member states having some part of their territory that does not fulfil all EU laws and regulations.

However, whether the EU would do a deal with the UK – when it was no longer a member state – that was differentiated between rUK and Scotland is open to question. Politically, the EU may be tempted to do so, given Scotland’s positive vote for staying in the EU, but it is not a foregone conclusion. And there would be practical questions too.

If Scotland followed all or most EU laws while rUK didn’t would this set up inconsistencies within the UK in terms of internal trade or pan-UK laws? The answer to that is likely to vary according to issues. It may in part be possible, but it will be tricky. If it turns into a patchwork where in some areas Scotland and rUK have the same standards and laws, in some Scotland follows EU laws and rUK doesn’t, and in some Scotland doesn’t follow EU laws, it may create more complexity than is worth having.

What is inconceivable is that Scotland while part of the UK state could also somehow be an EU member state. EU member states are able to sign international treaties, give the EU competence to negotiate trade deals on their behalf, agree unanimous foreign policy positions, and conclude EU treaties and treaty changes together. To do this, Scotland would need to be independent.

Independence or not, Scotland must explore the EU routes ahead

Scotland faces many challenges ahead. It has to chart a path through the question of its relations with the EU, even while the rUK looks like remaining in foggy chaos for many months and years ahead over what sort of future relationship with the EU it will have.

Independence for Scotland would be the most straightforward route to staying in the EU, and would give Scotland a seat at the top table. But while the risk remains of Scotland being dragged out with the rest of the UK, Scotland should explore too the options for remaining more integrated with the EU than the rUK.