Sir David Edward has challenged the "assumptions" of European Commission president Jose Manuel Barroso that EU treaties "would no longer apply" to countries that secede from an EU member state.
Sir David, who sat on European Courts for 15 years, argues that Scotland would not enter EU "legal limbo" at the point of separation.
But he has also advised that "the length and complexity of the negotiation and ratification process cannot be predicted in advance".
The Scottish Government hopes to establish the first independent Scottish Parliament in 2016, arguing that EU membership negotiations will take place in tandem with negotiations to leave the UK.
Mr Barroso said earlier this month that a newly-independent state would have to apply for EU membership, but Sir David today suggested this would not be the case.
In an article for The Scottish Constitutional Futures Forum, which was established to address unanswered questions over independence, including Scotland's uncertain future in Europe, Sir David said Mr Barroso's opinion is based on "assumptions".
He said: "It seems to be assumed that, contrary to the principles asserted in (EU treaties) that EU law does not recognise the democratic right of the inhabitants of Scotland to dissolve their constitutional union with those of England, Wales and Northern Ireland, other than at the cost of automatic loss of their acquired rights as citizens of the EU.
"Second, it seems to be assumed that at the moment of separation, or on some other unspecified date, Scotland, its citizens and its land and sea area would find themselves in some form of legal limbo vis-à-vis the rest of the EU and its citizens, unless and until a new Accession Treaty were negotiated.
"Until the moment of separation, Scotland would remain an integral part of the EU; the Scottish people and all EU citizens living in Scotland would enjoy all the rights of citizenship and free movement; and the same would apply, correspondingly, to all other EU citizens and companies in their relations with Scotland.
"Then, at the midnight hour, all these relationships would come abruptly to an end."
He said this would release Scotland from EU constraints on corporation tax and VAT, permit Scotland to charge EU students tuition fees, allow it to expel non-Scottish fishermen from its vast sea territory and leave an EU security vacuum over the North Sea.
"Apparently there would be no legal obligation upon the UK, the EU or the other member states to enter into any negotiations before separation took effect in order to avoid such a situation coming to pass," he added.
But Sir David also argues that the contrary contention that an independent Scotland would enjoy a "seamless" transition into the EU subject to agreement on a few details is also incorrect.
The UK, EU institutions and member states would "be obliged to enter into negotiations before separation took effect, to determine the future relationship within the EU of the separate parts of the former UK and the other member states," he said.
Sir David added: "The length and complexity of the negotiation and ratification process cannot be predicted in advance."
SNP MSP Aileen McLeod said: "This is a very welcome and authoritative opinion by Sir David, one of Europe's most experienced EU legal experts, setting out the clear position that negotiations would take place from within the EU after a Yes vote and before Scotland becomes an independent country.
"It is based on solid, well-documented assumptions which confirm the position of common sense and political reality.
"It will be in the interests of the rest of the UK and the whole of the European Union, as well as Scotland, for our membership of the EU to continue as an independent country, and we will negotiate from a position of strength, with around 90% of the EU's oil reserves and a huge share of the EU's renewable energy, as well as some of the richest fishing grounds in Europe."
Scottish Conservative leader Ruth Davidson said: "This point of view does not echo what Alex Salmond and indeed the Yes campaign have been saying.
"Desperate attempts to pretend it does shows just how far they will go to con the people of Scotland on this issue.
"What Sir David Edward is saying is there will have to be negotiation. That could take years, involve the creation of border controls and affect the rebate and tax harmonisation.
"These amateur tactics of bluster and assertion show nothing but contempt for the people of Scotland."
Meanwhile, a former SNP chairman has challenged the arguments for remaining in the EU at all, arguing that Scotland would prosper in the European Free Trade Association (Efta).
The 52-year-old body represents four European states: Iceland, Liechtenstein, Norway and Switzerland.
Gordon Wilson, who led the SNP in the 1980s, greeted reported comments by Icelandic president Olafur Grimsson who said independence "can be the road towards prosperity and a good society".
Mr Wilson said: "So far the independence debate in Scotland has all been about whether Scotland should be in the European Union.
"Now, the president of Iceland is publicly linking Scotland with the advanced countries of Northern Europe.
"It is a great feature that he has mentioned the target of a 'good society' that has so far been absent from the debate.
"After the hostile response of president Barroso, this more sympathetic response from Iceland, a member of Efta, is more than welcome.
"As Jim Sillars, a former SNP deputy leader of the SNP and I pointed out recently it could be more beneficial for Scotland as an independent nation to join Efta rather than be a regarded as a 'beggar at the gate' of the EU.
"An independent Scotland should emulate the members of Efta and Scandinavia countries with their forward-looking societies and prosperous economies, and give short shrift to the European Union economic disaster."