THE polling stations had opened in Barcelona as I sat down on Sunday to make a start on this column. By yesterday morning, when I got up bright and early to write the final paragraphs, Catalonia had a good idea of its election results. More people had voted for independence than last time yet the outcome remained problematic because, unlike in Scotland, the system tends to encourage rather than discourage small political parties.

Scotland and Catalonia are still worth comparing because we both stand at a crucial point in the process of nation-building or nation-rebuilding.

We have in the past half-century moved well away from provincial subordination re-inforced by an alien central authority in somebody else’s distant capital. Scots and Catalans have embarked on a great journey, but few of us think it has yet come to an end. And anyway, how could you possibly tell? In fact, there is no certainty about the final destination, though we may find meanwhile that we have already reached it.

The past history is similar, too. Scotland and Catalonia were once independent nations, and the memories remain so strong as to influence everyday life in countless ways. Catalonia’s ancient royal line died out in 1700, and the other European powers took it on themselves to choose a new one. France and its allies proposed Philip of Anjou, a grandson of King Louis XIV. The Holy Roman Empire, the Dutch Republic and England preferred Archduke Charles of Austria.

Scotland got drawn into what followed, the War of the Spanish Succession (without being asked, of course). In London, Queen Anne thought the Scots “such a strange people” and listened only to her English ministers, who ran our foreign policy and paid our army.

READ MORE: What Scotland's independence movement can learn from the Catalan elections

But in the actual fighting, two Scots played prime parts. One was John Campbell, Duke of Argyll, who took command in Barcelona. The other was James, Duke of Berwick, bastard son of King James VII by Arabella Churchill, sister of the English general, the Duke of Marlborough. For bonking as for battles, these people were unsurpassed.

Later, Berwick led the storming of Barcelona that killed off Catalan freedom in 1714, just seven years after Scottish independence had been lost. Argyll was already at home again, and would soon put a messy end to the Jacobite rebellion of 1715.

Three centuries later, Scots and Catalans are each once again engaged in a struggle for the destiny of their country. We in Scotland face an election in May. Catalonia has just elected a new parliament under its constitution as an “autonomous community”, one of the regional rankings available in the Spanish system of devolution.

Over the three centuries this odd pair of peoples have reacted in two ways. During the first couple, they learned to acquiesce to their fate and sought to compensate for it by concentrating on success inside a greater empire. But then in Catalonia came a horrific 20th century, with more war and destruction on its own soil. Still, war and destruction often bring with them great opportunities for the capitalist system. Barcelona took the lead in modern Spanish development, especially the manufacture of ships, cars and textiles.

​READ MORE: Top secret! What the Union Unit’s getting up to down in Churchill’s bunker

As a result, many businessmen moved there from other parts of Spain, to create an economic powerhouse for the whole country. It also produced a political problem, because the population of the city now has a narrow Spanish-speaking majority, whereas the rural territory to the north and west remains largely Catalan-speaking.

Still, overall the ensuing experience was positive for Catalonia, which developed modern trade and industry and, after the return to democracy in 1977, enjoyed steadily rising prosperity. Today, it is far and away the richest of Spain’s 17 provinces, with a standard of living to match any round the shores of the Mediterranean Sea.

WHAT is more, it has been achieved through conscious exploitation of the opportunities offered by the capitalist system. They are re-inforced by the legal basis for the EU’s internal market in the Treaty of Maastricht 1993. Even after 20 years, the market may be still some way from complete.

Indeed, hypocritical national governments connive at frustrating it so as to protect industries of their own. But the most dynamic party in Catalonia, the right-wing Junts (Together), continue to sing the praises of free markets in the faces of local leftists.

That is certainly the line taken by the Catalan politician best known in the outside world, Carles Puigdemont. He led the region after the last election in 2017, though his attempt to hold a referendum on independence led to violent intervention by the government in Madrid. He fled abroad but was eventually elected to the European Parliament, in which no national government can interfere. A number of his slower colleagues are now in prison.

Puigdemont’s economic policies were one of the main reasons for his popularity. Catalonia is a country with a long-standing industrial tradition, which has also proved adept at adjusting to the demanding post-industrial conditions of the 21st century.

Especially in the metropolitan area of Barcelona, there is innovative strength in a dense community of small and medium-sized companies. Large multinationals also form an active presence, particularly in the motor industry, telecommunications, biomedicine and food production. In addition, there is a long tradition of scientific research.

​READ MORE: Michael Russell: Brexit and independence are two sides of the same coin

Catalonia has been a prominent trading nation since the Middle Ages, so its economic progress has always depended on its connections with the rest of the world. It accounts for 16% of Spain’s population but generates more than one-fifth of gross domestic product and one-quarter of exports.

Whatever the political course of the next few years, it seems clear this commitment to capitalism will continue.

We can mark out common ground between Scotland and Catalonia, but there are clearly differences, too. Scotland also has a capitalist economy, but it would be hard to say there is any great enthusiasm for it in the population at large and especially not among politicians.

Nicola Sturgeon’s Government obviously assumes control of the economy is one of its main tasks. To curry her highest favours, businessmen have to sign up for a long list of worthy social aims. Nobody is going to listen to them if they can’t or won’t.

In particular, the First Minister is totally indifferent to commercial profit, and I suspect she thinks it is actually rather undesirable. Businesses that make profits are suspected not of producing things people want to buy at a price they want to pay, but of exploiting their workers and customers.

We are obviously still a long way from any open discord, but once an independent Scotland sought to enter the EU these differences would have to emerge into the open. In the same position, the Catalans could easily come to terms with the existing member states. I wonder if it would be so easy for Scots, or indeed possible at all.