Image caption Alex Salmond said his government's position was backed up by expert opinion

Scottish First Minister Alex Salmond has accused rivals of "scaremongering" over the nation's position in the EU under independence.

His comments came after the Spanish prime minister suggested an independent Scotland would have to apply to become a member of the EU from the outside.

Mr Salmond said Scotland's membership would be negotiated "from within".

Opposition leaders accused him of being an "amateur" and "the Northern Hemisphere's worst negotiator".

The exchanges, during first minister's questions at the Scottish Parliament, were prompted by comments from Spanish PM Mariano Rajoy on Wednesday that, if a "region" opted to leave a member state, 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 added.

This shows just what a shower of rank amateurs the SNP government is when it comes to international diplomacy Ruth Davidson, Scottish Conservative leader

The ongoing political row over Scotland's EU position comes ahead of the nation's independence referendum, on 18 September next year.

Scottish Labour leader Johann Lamont said: "Yesterday, the Spanish prime minister made it clear that, by leaving the UK, Scotland would also leave the EU and have to re-apply as a new member.

"What part of that statement does the first minister not understand?"

Ruth Davidson, the Scottish Conservative leader, added: "This shows just what a shower of rank amateurs the SNP government is when it comes to international diplomacy.

"What the first minister doesn't understand is that, it doesn't matter if he gets 15 member states on board, or 25, 26 or even 27 - he needs the governments of every single one of 28 countries to agree to his demands."

The Liberal Democrats' Willie Rennie told parliament that Mr Salmond was seen as "the worst negotiator in the northern hemisphere", adding: "Every country has had to trade things away to secure a place in the EU - is he going to sell out our Scottish fishermen for a Spanish vote?"

But the first minister said his government's position that an independent Scotland could negotiate its position from within - and inside an 18-month timescale - had been backed up by expert opinion.

Image caption Mariano Rajoy strongly opposes an independence referendum being held in the Spanish region of Catalonia

Mr Salmond said a letter from the office of the EC secretariat general stated it would be "legally possible" to negotiate from within, adding that Prof James Crawford, who had advised the UK government on Europe, said the timescale "seems realistic".

His comments sparked a row in parliament over the source of the letter.

Ms Lamont said it was discovered following a "trawl of the internet" and asked whether it was appropriate to conduct "government by Google", although the document was genuine.

The SNP later released a statement from John Lind, secretary of the SNP's Aberdeen Central branch, who said he secured the letter from European Commission official Mario Tenreiro.

Labour's Johann Lamont, Ruth Davidson of the Conservatives and Willie Rennie of the Liberal Democrats reckoned it was a big problem for Mr Salmond

He said: "I was very pleased to receive this letter from the European Commission which makes it perfectly clear that Scotland can negotiate its position from within the European Union, and equally pleased that the first minister referred to it at First Minister's Questions.

"It is absolutely right that such information is in the public domain. It reflects the expert opinion on the subject and indeed common sense, which is no doubt why the opposition parties don't like it."

He insisted: "The letter is genuine, Scotland is a European nation and will become an independent European member state in March 2016, after we vote Yes next September."

The first minister also told MSPs that Sir David Edwards, who formerly served as a British judge in the European Courts of Justice, had commented that EU institutions and member states would be "obliged to enter into negotiations before separation took effect", to determine future relationships.

Mr Salmond said: "Scotland is a European nation. Resource-rich Scotland would be welcome. Anybody with an ounce of sense knows that."

Turning to the official campaign to keep the Union, he added: "Can Better Together not just get off the scaremongering and embrace the idea that this nation is a European nation."

Prime Minister Rajoy's comments came in a media conference during a summit with French president Francois Hollande.

He said: "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.

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.

SNP MEP Ian Hudghton directly criticised the Spanish premier while giving evidence to the Scottish Parliament's Europe committee.

"I think the context of the Spanish Prime Minister's remarks have to be read bearing in mind he's running his own project fear, big-style, at the moment," said Mr Hudghton.

The title "project fear" is the term Better Together campaign has given itself, the SNP has said.