SPAIN has moved to try to block a Scottish-style independence referendum in Catalonia.

Prime Minister Mariano Rajoy has urged the country's most senior court to declare the proposed November 9 ballot illegal, paving the way for months - if not years - of constitutional deadlock.

The arch-unionist conservative has long insisted only the entire electorate of Spain can undo the 1979 constitution, forged after the death of dictator Francisco Franco to allow regions autonomy as a trade-off for losing the right to break away.

Mr Rajoy said the Catalan ­referendum, called "9-N" for short because of its proposed date, amounted to "a grave attack on the rights of all Spaniards" and said the constitution "was based on the indissoluble unity of the Spanish state".

He has formally asked Spain's Constitutional Court to rule on a law signed by Catalan President Artur Mas on Saturday to allow 9-N to go ahead.

Polls suggest the vast majority of Catalans want a vote - more than 1.5 million took to the streets of the Catalan capital Barcelona in favour of their "right to decide" earlier this month - although far from as many say they will back independence.

Mr Rajoy hinted he was willing to talk to Mr Mas and others over shaking up Spain's system of asymmetrical devolution, a model currently being discussed by UK unionists as a way of dealing with varying demands for autonomy in Scotland, Wales and Norther Ireland.

However, he made it clear his red line was a Scottish-style independence referendum. He said: "The priority now is to defend the constitution. After that there could be reform."

Spain's socialist opposition leader also opposes Catalan ­independence, but took a different line. Pedro Sanchez said: "The best way to defend the constitution is renovation."

This month's Scottish vote has figured prominently in polemics over 9-N, with Catalan leaders highlighting the "British" fair play of UK Prime Minister David Cameron for allowing a referendum while Mr Rajoy refuses to do so in Catalonia.

The fact Scotland had a referendum was always more important than its result to Catalans, some of whom carried Saltires and portraits of Mr Cameron during recent demonstrations.

Spanish unionists have always feared the Scottish vote would lead to pro-independence "contagion" in other stateless nations in Europe, such as Catalonia and the less easily defined Basque countries of northern Iberia and south-west France.

During Scotland's referendum campaign, Mr Rajoy issued veiled threats that Spain would not be helpful to an independent Scotland, suggesting, for example, that it could take years to re-enter the European Union.

The SNP, eager not to provoke such remarks from Spain, has largely kept out of Catalan and Basque politics, despite a formal alliance with Mr Mas's left-wing nationalist rivals Esquerra Republicana.

Mr Mas, of the centre-right CiU alliance, has taken a softer line than Esquerra, suggesting he would not be ready to defy the Constitutional Court if it rules his vote invalid.

Now Esquerra has offered to join the Mas government to bolster its resolve, raising the spectre of an autumn stand-off.