Media playback is unsupported on your device Media caption Mariano Rajoy strongly opposes an independence referendum being held in the Spanish region of Catalonia

The Spanish prime minister has suggested that an independent Scotland would have to apply to become a member of the EU from the outside.

Mariano Rajoy said that if a "region" opted to leave a member state, then it would "remain outside the European Union".

It would then require the agreement of all 28 EU members before it was allowed to join, he said.

The Scottish government aims to negotiate entry from within the EU.

This would be done in the 18 months between a Yes vote and formal secession from the UK, it has said.

We have detailed a process which will see Scotland negotiate its position as an independent member of the European Union from within Scottish government spokesman

Speaking at a media conference during a summit with French president Francois Hollande, Mr Rajoy said: "I do not know the White Paper presented by the Scottish president (sic).

"I would like that the consequences of that secession be presented with realism to Scots.

"Citizens have the right to be well informed and particularly when it's about taking decisions like this one.

"I respect all the decisions taken by the British, but I know for sure that a region that would separate from a member state of the European Union would remain outside the European Union and that should be known by the Scots and the rest of the European citizens".

His stance appeared to echo the official position of the European Union.

However, Mr Rajoy did not say he would seek to block an independent Scotland's subsequent entry to the EU.

The BBC's Tom Burridge, in Madrid, said the Spanish prime minister's comments were being seen as an implicit warning to the Spanish region of Catalonia, whose autonomous government wants to hold a vote on independence.

Mr Rajoy strongly opposes having an independence referendum in Catalonia, in north-eastern Spain.

But the Catalan government says it plans to announce the date of its referendum, and the question it will put to Catalan voters, before the end of this year.

Analysis This was a calculated move by Spain's Prime Minister. Mariano Rajoy had prepared his answer. Pro-independence Catalans have, in the past, tried to use the case of Scotland to their advantage: How can Spain deny Catalans a referendum, when David Cameron is willing to grant the Scots a vote on independence from Britain? So Mariano Rajoy is fighting-back, with an argument which the political right in Spain, and his government, have used on numerous occasions about Catalonia in the past. This time though, Mr Rajoy wanted to be clear about the principle at stake, so he spoke about Scotland: A new independent state, would NOT automatically gain entry into the EU. All 28 member states, including Mr Rajoy's government, would have to approve that state's entry into the club. No, Mr Rajoy did not say that he would block a request for entry into the EU by an independent Scotland further down the line. But implicit was a warning: Don't assume you have our support. Of course, the idea of Spain blocking an independent Scotland's entry into the EU would be hugely controversial, and it's a situation that Mariano Rajoy is hoping won't arise. But don't disregard how passionate a section of Spain's political right feels about the issue of national unity. This was a very divided country in the, not too distant, past. Mr Rajoy is under real pressure from people in his own, broad right-wing party. And then there's the fact that the situation in Catalonia is far more uncertain than that of Scotland. Spain's government refuses to even negotiate the idea of a referendum, but Catalonia's government is pushing on regardless. They plan to announce details on their vote, also planned for 2014, before the end of this year. With the two sides so divided, the two governments, one regional and one national, in Barcelona and Madrid are in a fierce fight for international support, reminiscent of a Clasico derby between the two giants of Spanish football. Both know that, with the situation at loggerheads, what happens in Scotland could play a larger impact on the question of Catalonia, rather than the other way round. Perhaps that's why, when I called last night, a delegation of the Catalan government, including their charismatic president, Artur Mas, was in Mumbai, of all places, wooing influential Indians with the best of Catalan culture and business.

Speaking on Newsnight Scotland, Finance Secretary John Swinney said Scotland was already part of the European Union by virtue of its membership as part of the UK.

To gain membership as an independent state, he said Scotland would apply for an amendment to The Treaty on European Union under Article 48.

This would need to be approved by all 28 member states.

"We are members of the European Union," he said.

"Once Scotland votes for independence - a Yes vote in September 2014 - we remain still within the European Union and the day of independence doesn't happen until 2016.

"So we are doing this from within the European Union as part of our membership."

Scottish Labour leader Johann Lamont said the Scottish government had previously said that under independence its membership as an independent state would be automatic.

She said: "If you move to a position where it would be automatic to saying you would need agreement, then you have to contemplate the possibility that somebody might disagree."

Responding to Mr Swinney, she said: "You have told us in the past you want to remain within the European Union.

"It would now appear that's assertion, like so much in here, rather than actual documented fact."

Require negotiations

The Scottish government's White Paper on independence, which was published on Tuesday, devotes about nine pages to EU membership.

It has also published a further 100-page document which focuses on the EU.

Writing in the document's foreword, Deputy First Minister Nicola Sturgeon said the government recognised that EU membership would require negotiations with other member states and institutions.

But this could be done from within the organisation in the period between a Yes vote in September next year and day one of independence in March 2016, she argued.

The report asserted that it was wrong on three counts to say Scotland would have to leave the EU and reapply from outside:

Scotland has been an integral part of the EU for 40 years

It would be against the self-interest of the EU collectively and individually

It would deny the democratically expressed wishes of the Scottish people

A spokesman for the Deputy First Minister said: "Scotland's future is first and foremost a matter for the people of Scotland.

"We note that the Spanish Prime Minister has said he has not read our proposals, but Mr Rajoy has previously indicated that he considers the Scottish and Catalan situations are 'absolutely and totally different'.

"That is because the process for Scotland becoming independent is enshrined in the Edinburgh Agreement, where the UK government has pledged to respect the outcome of the referendum.

The Spanish prime minister has just blown Alex Salmond's case for EU entry out of the water Ruth Davidson, Scottish Conservative leader

"As the papers we have published outline, we have detailed a process which will see Scotland negotiate its position as an independent member of the European Union from within, during the 18-month period between a Yes vote and independence day - a period when we will still be part of the EU as part of the UK, and which has been described as 'realistic' by the UK government's own legal adviser.

"That process, under Article 48 of the Treaty of the EU, allows for Scotland to become a member state at the point of independence.

"Scotland is already an integral part of the EU, and there is nothing in the entire body of EU treaties which provides for the expulsion of an existing territory or the removal of its inhabitants' rights as EU citizens."

But Better Together leader Alistair Darling said Mr Rajoy's comments were "another blow to Alex Salmond's claims that nothing would change if we vote to go it alone".

He added: "The Spanish Prime Minister has just made it clear that everything would change.

"We now know what the position of the Spanish government would be if we vote for independence. This has created even more uncertainty."

Scottish Conservative leader Ruth Davidson said: "The Spanish prime minister has just blown Alex Salmond's case for EU entry out of the water.

"We need to know what advice the SNP received before they laid out their threadbare case in the White Paper, whether they'd spoken to other member states or even checked basic facts with EU officials."