Alex Salmond's case for an independent Scotland remaining in the EU received a boost on Thursday after a judicial expert said unacceptable damage would be caused if Scotland was kicked out of the union.

The intervention by Sir David Edward – formerly the UK's judge on the European court of justice – came as the first minister produced a letter from a European commission official stating it was legally possible for Scotland to stay within the EU without having to reapply as a new member state.

But the significance of that disclosure was quickly undermined after it emerged that Salmond's aides had downloaded the letter from a nationalist website, Newsnet Scotland, and had not been officially sent that opinion by Brussels.

The commission letter, brandished by Salmond as he faced a barrage of attacks on his EU policy from opposition parties at Holyrood, raises doubts about the repeated stance taken by José Manuel Barroso, the commission president, that Scotland could only apply for fresh membership once it became independent.

Edward, who sat on the court of justice from 1992 to 2004, told the Guardian that Scotland's referendum had to be seen as a constitutionally proper process which had been agreed by both elected governments in Edinburgh and London.

Describing himself as a "moderate unionist" who supports remaining in the UK, Edward said the legal and political complications of Scotland being ejected from the EU after independence were huge for the UK's economy, Scotland's citizens and businesses and for EU citizens living in Scotland.

"Assuming a yes vote in September 2014, there then immediately arises an obligation to negotiate in good faith to avoid the unacceptable situation that would arise if arrangements were not made for Scotland to remain in the EU," Edward said.

"And that obligation is as much incumbent on the government of the UK, which remains the government of Scotland during that period, with responsibilities to safeguard the rights of its citizens, including those who voted no." Those negotiations would be difficult for both sides, he added, but necessary.

Salmond was meanwhile accused by opposition parties of being a "rank amateur" and without "a shred of honesty" after his official spokesman told reporters after first minister's questions the letter Salmond had produced was not official correspondence to his government.

The Scottish National party later said the original request had been sent to Barosso's office by John Lind, secretary of the SNP's Aberdeen Central branch. His name had been deleted from the copy that Salmond said he would lay in the Scottish parliament's library and the copy of the letter given to reporters by Salmond's spokesman.

Opposition parties challenged Salmond after Mariano Rajoy, the Spanish prime minister, said he opposed the Scottish government's case that it ought to be allowed to quickly and smoothly negotiate Scotland's new EU membership within 18 months of next September's referendum and before it became independent.

Speaking on Wednesday night in Madrid, 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."

While Rajoy did not say he would veto Scotland's membership, his intervention implied that he would resist it strongly, raising doubts that Salmond would be able to win the total unanimity of all 28 member states required to win entry to the EU on the terms he wants.

While Rajoy's central concern is the threat of Catalan independence, Salmond's opponents argue that Spain's stance severely damages the credibility of Salmond's independence case with Scotland's undecided voters, who will be crucial in deciding the referendum result.

The Scottish government is already trying to win allies among smaller Baltic, Scandinavian and east European EU members who agree that Scotland has a clear legal and political right to membership if Salmond wins the referendum.

As part of that initiative, Fiona Hyslop, Scotland's external affairs minister, briefed senior Spanish and other European diplomats in London on Wednesday on her government's proposals to use "common accord" measures to quickly amend the Lisbon treaty, in a bid to build support for those proposals.

Scottish sources also say Rajoy would come under intense pressure from major Spanish companies, such as the energy giant Iberdrola, which wholly owns Scottish Power, if a serious dispute over Scotland's future in the EU threatened their business interests in Scotland and the UK.

Salmond said the commission letter, which also had its senders' name deleted, proved that EU officials agreed that Scotland would not have to be forced to leave the EU and reapply afresh alongside other candidate states.

The letter from Mario Tenreiro, of the commission's secretariat general, stated: "It would, of course, be legally possible to renegotiate the situation of the UK and Scotland within the EU. Of course, this would imply a change of the treaties which could only be done by unanimity of all member states."

Tenreiro added, however, that the commission was unable to comment on Scotland's legal position until the UK government formally asked Brussels to do so.