Alex Salmond's plans for an independent Scotland to smoothly join the European Union have been dealt a painful blow after the Scottish first minister's proposals were dismissed by Spain's prime minister.

Mariano Rajoy said his government believed an independent Scotland could only apply to join the EU from outside the organisation as a new state, as he warned against regions of Europe embarking on "solo adventures in an uncertain future".

His intervention confirms long-held suspicions that the Madrid government will resist the Scottish government's plans because of its rejection of Catalonian independence, which has seen large marches in Barcelona in favour of secession.

While Rajoy's government faces an election in late 2015, before Scotland formally seeks to become independent, it will be seen as an effective veto on immediate Scottish entry to the EU, threatening to have a fatal impact on Salmond's hopes of winning next year's referendum.

Already trailing in the polls, Salmond has repeatedly insisted that EU membership for Scotland will be smooth and pain-free, and would allow Scotland to retain sterling as its currency, the UK's opt-outs on policies such as Schengen border controls and the UK's rebate.

Speaking at a joint press conference with the French president, François Hollande, Rajoy said: "It's very clear to me, as it is for everybody else in the world, that a country that would obtain independence from the EU would remain out of the EU, and that is good for Scottish citizens to know and for all EU citizens to know."

Rajoy said EU treaties "apply only to member states that have agreed and ratified them, and if a part of one member state cleaves from the member state, it converts itself into a third part with relation to the EU."

"That is the law and that law applies."

He added: "In no way does it benefit our European regions and our citizens to propose divisions or solo adventures in an uncertain future in which the exit points may seem clear but the destination is unknown."

In a statement the UK government appears to have anticipated, Rajoy said he would expect David Cameron, the UK prime minister, to take the same position if Catalonia sought to join the EU as an independent state.

On Tuesday the European commission signalled it was sticking to the stance taken by the commission president, José Manuel Barroso, that a region of a member state which gained independence would be seen as a new state, outside the EU.

Speaking shortly after Salmond released his 670-page white paper on independence, a commission spokesman said its "well-known position" on this had not changed.

"I can specify that the treaty provides some clear articles when it comes to the need for a new, third country to apply to the EU if they want to join," he said. "Any process of a particular region of a member state leaving this member state will have treaty implications."

Rajoy's statement came as Scotland's external affairs secretary, Fiona Hyslop, continued a series of private meetings with European diplomats to press the Scottish government's case that the European treaty could allow Scotland to join via a "common accord" process without the need to formally apply as a new member state.

A spokesperson for deputy first minister, Nicola Sturgeon, said there was no provision in the EU treaties for existing EU citizens to be forced to leave the organisation.

She said that there was also a significant difference between Scotland's quest for independence and the secession movement in Catalonia, as Scotland's referendum was officially supported by the UK government.

"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'," she said.

"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."

A smooth and fast transition into the EU is crucial to Salmond's plans for Scotland to achieve independence with the minimum of disruption and economic risks.

He also believes Scotland should be allowed to keep using sterling and reject the euro, and retain all the UK's rebates and existing opt-outs – policies observers believe are unlikely to be accepted by EU members and are likely to rile the Spanish and other powerful EU states.

Based on legal advice from the Lord Advocate, Frank Mulholland, Scotland's chief law officer, Sturgeon said the Lisbon treaty had provisions under Article 48 where all 27 member states could agree to allow Scotland to make a smooth transition to membership in the 18 months after independence.

That process would allow the treaty to be amended through an "ordinary revision procedure initiated by the United Kingdom government".

Only an hour or two before Rajoy's press conference, the UK government said that was "a very novel interpretation of EU law".

A spokesman stated: "The legal basis for the conventional and widely accepted position that, as a new state, an independent Scotland would have to apply to join the EU is set out in the legal paper published in February.

"Nor is it clear from this document what grounds they have for their strong assertion that an independent Scotland will somehow automatically retain the UK's opt-outs or a share of the UK rebate – we can see no legal or political basis for such an emphatic claim.

"It will be interesting to see how other [EU] member states react to the claims the Scottish government have put forward in this document."

Willie Rennie, the Scottish Liberal Democrat leader, said Spain could be followed by other EU member states: "The nationalists insisted an independent Scotland would not be put outside the European Union but this intervention from the Spanish prime minister directly contradicts this assertion.

"Hard won opt-outs on Schengen, the Euro and the rebate would be in doubt and might have to be traded away to get back in. At breakfast the SNP said there was little doubt, by teatime there was little certainty."