SCOTLAND has offered to mediate between Spain and Catalonia as the two Iberian nations enter a constitutional crisis.

Catalan nationalists swept back in to power this weekend in parliamentary elections widely billed as a proxy referendum on independence.

The government in Barcelona is now firmly on a collision course with Madrid politicians who believe any attempt at breakaway - or even a Scottish-style vote - would be illegal.

The Scottish Government, sources said, believes it could "mediate and assist both the Spanish and Catalan governments" using its "recent experience in a consensual referendum process".

Its offer - delicately put by Cabinet Secretary Fiona Hyslop - comes after politicians on both sides of the constitutional divide in the UK called for a Scottish-style vote to settle the independence issue in Catalonia.

The current Spanish Government of Conservative Prime Minister Mariano Rajoy has rejected any democratic vote in Catalonia. Spain's Constitutional Court vetoed a putative referendum last year.

Catalan President faces court after being accused of organising illegal referendum

Herald View: Why the SNP has made its Catalan offer

David Leask on who really won Catalonia's baffling independence elections

It was this that prompted pro-independence parties to join forces this year to run on a single ticket in parliamentary elections they regarded as plebiscitary.

Two "Yes" slates took 48 per cent of the vote - falling short of a much-desired popular majority - with outright "No" parties securing just 39 per cent and the rest going to ambivalent tickets.

Both sides claimed victory yesterday.

Ms Hyslop said: "We congratulate those who have been successful in the Catalan elections.

"What happens next is a matter for the people and the Governments of Catalonia and Spain.

"The constitutional arrangements in Scotland and the UK which paved the way for last year’s legally binding independence referendum, and a vibrant constitutional debate, were part of a process agreed by both the Scottish and UK Governments.

"The constitutional arrangements in Scotland and the UK are clearly different to those of Spain and Catalonia but should we be invited we stand ready to share our experiences with Spain and Catalonia."

The carefully coded remarks conceal one of the most daring diplomatic gambits made by the SNP in government.

The party has been eager to stay out of what insiders call "Iberian entanglements" and has always stressed the differences between its cause and that of the Catalans.

Speaking yesterday, First Minister Nicola Sturgeon fell short of a public offer of mediation but stressed the role the Edinburgh Agreement could play as a model for addressing secession questions around the world.

Ms Sturgeon said: "I'm sure many people in Scotland, given our recent experience of a referendum, will be looking with great interest at what is happening in Catalonia.

"We know from the experience of the referendum that many Catalans look with great interest at what happens in Scotland, but we are two different countries with different circumstances, different situations, different experiences and the future of Catalonia will be decided by the people of Catalonia.

"My view is that it was a credit to both the Scottish Government and the UK Government that our referendum happened as a consensual democratic exercise in self-determination.

"I think Scotland has given the world an example of how to make these big decisions in absolutely the right way."

The SNP's landslide win in the 2011 Holyrood elections was accepted as a mandate for a Scottish independence referendum by the Westminster government, which temporarily handed Holyrood the constitutional power to hold a legally-binding vote on September 18 last year.

Scotland voted by 55 per cent to remain in the UK but subsequently handed the SNP another Scottish landslide in the UK general election with fully 50 per cent of the popular vote.

Catalan "independentistes" have now formed a single main electoral alliance, Junts pel Sí, Together for Yes, which took 40 per cent of the vote on Sunday. It must now govern with the support of a second pro-independence ticket, the left-wing CUP party, which won eight per cent.

Ms Sturgeon has now pledged to set out the circumstances that she would deem appropriate to hold another independence referendum in her forthcoming 2016 Holyrood election manifesto.