IT’S late 2022 – in the aftermath of Scotland’s second independence referendum, held on the 10th anniversary of the Edinburgh Agreement. But this was not a legal ballot.

The Prime Minister, Boris Johnson, who replaced Theresa May as Tory leader in 2021, ruled that Scotland’s referendum was illegal and an act of rebellion. “A mere region,” he says, “cannot depart the sovereign United Kingdom, which has a unitary constitution, confirmed by rulings of the Supreme Court.”

As the ballot boxes were being distributed around Edinburgh, armed police moved in and hundreds were injured. Nicola Sturgeon was forced to flee to Dublin, where the Irish government withdrew its ambassador to the UK in protest. Other members of the Scottish cabinet have fled to Slovakia and Estonia.

Politicians who organised the ballot, including the former chief executive of the SNP, Peter Murrell, and the Scottish Green Party leader, Patrick Harvie, have been arrested and charged with treason under legislation dating from the Middle Ages. As their trial opens in London, there are mass demonstrations from the so-called “Tartan Vest” movement across Scotland as the government declares martial law ...

Far-fetched? Perhaps. But that’s what happened after Catalonia’s illegal referendum in October 2017. Twelve politicians and civic leaders appeared in court in Madrid yesterday charged with violent rebellion – a crime which carries a 25-year sentence. This for organising a peaceful referendum for which the elected government of Catalonia believed it had an electoral mandate.

The violence in 2017 was almost entirely the responsibility of the Madrid government, which sent in the civil guard with a licence to use force. The pro-independence protesters kept their cool and did not meet violence with violence – yet its organisers have already spent some 16 months in detention awaiting trial, longer than many criminal sentences.

The Prime Minister of Catalonia, Charles Puigdemont, remains in exile in Belgium. Attempts by the Spanish government to extradite him have failed on human rights grounds. A similar attempt to seize the former Catalan education minister, Prof Clara Ponsati, while teaching at St Andrews University, also failed.

It’s assumed that Spain’s new socialist Prime Minister, Pedro Sanchez, would like to draw a line under this affair, which he inherited from his conservative predecessor, Mariano Rajoy. Mr Sanchez dropped the extradition orders in July, but the highly politicised courts in Madrid may think otherwise. Once this kind of repression is applied by a democratic government it rapidly become self-perpetuating.

The defence team will almost certainly appeal the case to the European Court of Human Rights if they fail to secure the release of the Catalan 12. What many supporters of Scottish independence find incomprehensible is the failure of the European Union to condemn the Spanish government for what most see as a gross violation of civil rights.

What does all this mean for Scotland? Madrid has always insisted there should be no read-across to the UK. They say that the Spanish constitution, of 1978, is very different to the UK’s, in that it explicitly outlaws secession. Madrid argued that this was necessary to ensure the stability of the country following the ending of Franco’s fascist rule in 1975 . Yet the kind of repression imposed recently by Madrid seems all too reminiscent of the former dictator.

However, that history aside, the situation is not that dissimilar here. The UK is an indivisible unitary state as the Supreme Court ruled last year. After the UK leaves the EU, Brexit Britain will be a very different place to the looser multi-national entity of 2012. The powers of the Scottish Parliament have been significantly curtailed by the EU Withdrawal Act. It seems to me inconceivable that any UK government post-Brexit would entertain the idea of a Scottish independence referendum – at least not for a generation. It would be hugely destabilising to the Global Britain project if Scotland, with a third of the UK landmass, most of its hydrocarbons and all of its nuclear weapons, were to depart the UK.

Independence would create obstacles to trade deals with countries like the United States, which is likely to want changes to environmental standards and suchlike.

There would have to be a hard border in the North of England, because Scotland would immediately seek entry to the EU single market. Most importantly, the UK’s already diminished prestige would take a severe knock if the country were to appear to disintegrate in the aftermath of its departure from the EU.

Tory MPs no longer hide their impatience with nationalists. So a repressive response to an unauthorised referendum is far from inconceivable. Yet Nicola Sturgeon has said she believes Scotland will be independent in three to five years. This may be just an exercise in SNP crowd-pleasing. However, there is a limit to how often she can play the timetable game.

If the independence parties win a majority in the 2021 Scottish parliamentary elections, she will come under immense pressure to hold an “advisory” referendum on independence. If she tries to “reset” the timetable again, the SNP’s legendary unity would crack.

The Westminster government might not respond to an unauthorised ballot by locking up Scottish ministers and sending in riot police. But it will certainly refuse to recognise the result. Unionists in Scotland will anyway boycott the referendum, so any attempt to claim justification for a Declaration of Independence will be condemned as unlawful, not least by opposition parties in Scotland. Westminster might even try to impose a form of direct rule, as in Stormont, on the grounds that Scotland has become ungovernable.

This is a scenario which Scots who support independence need to consider. To repeat: it seems to me inconceivable that any government in Westminster will concede a legal referendum in the wake of Brexit for at least a decade. The independence movement in Scotland needs to start thinking now what its response would be to that rejection. It might be that the referendum route to independence is not the best one to take, and that it would be better to seek incremental change. Or it might mean a resort to civil disobedience as advocated by some in the movement. Whatever, Scottish politicians need to be prepared for the possibility that, like the Catalan independencias, they find themselves in court.

Read more: Pro-independence protestors clash with police in Catalonia