Scotland's First Minister Nicola Sturgeon has warned of a "strong backlash" if Scotland were to be taken out of the EU by a UK-wide referendum.
The SNP leader used a speech in Brussels to say a vote to take the UK out of the European Union could cause a "groundswell of anger" in Scotland.
Prime Minister David Cameron has promised an in/out EU referendum.
At the start of her address, Ms Sturgeon paid tribute to former Lib Dem leader Charles Kennedy who has died.
She said: "It's a dreadfully sad day for Scottish and UK politics. The news about Charles Kennedy is stunning and absolutely tragic.
"Charles was one of these rare things in British politics, he was a brilliant and effective politician, perhaps one of the most talented politicians of his generation. And yet somehow he managed to be universally liked."
Ms Sturgeon added that Mr Kennedy would have been a "big voice" in the forthcoming European referendum, which will take place before the end of 2017.
Turning to the substantive element of her speech, the first minister said Scotland had much to offer the EU and "much to learn" from the example of its smaller member states.
She called on Mr Cameron to agree to a "double majority" which would mean all four nations of the UK must back withdrawal before exit is possible.
Her speech comes days after Mr Cameron met a number of European leaders to canvass their views on reforming the European Union ahead of the UK vote.
In her first EU address as first minister, Ms Sturgeon said that "positive changes" could be made from "within the existing treaty".
She also raised the issue of Scotland's long-running legal bid to have a minimum price for alcohol.
The Scottish government is locked in a legal battle with Europe over setting a minimum price of 50p per unit of alcohol.
The Alcohol (Minimum Pricing) (Scotland) Act 2012 was passed by the Scottish Parliament in June 2012.
However, it has not yet been enacted due to a legal challenge filed with the Court of Justice of the European Union.
The Scottish government embarked on minimum pricing because it said the "alcohol problem in Scotland is so significant that ground-breaking measures are now required".
Ms Sturgeon's said: "The EU should focus on areas where joint working and co-operation will make a tangible difference to the lives of its citizens.
"In some areas, that means that the EU should leave member states with the autonomy to tackle pressing problems.
"Public health is a relevant example for Scotland and for other countries. Some years ago, the Scottish Parliament voted to introduce minimum pricing for alcohol, to tackle alcohol harm in our society.
"Our ability to do that has been challenged, and is currently being considered by Scottish courts and the Court of Justice of the European Union.
"We know from their support for our case that many other member states support us. My view is that the Commission and EU policy should recognise that.
"They should give a higher priority to enabling member states to take the decisions they deem necessary to protect life and promote health."
'Dump the pound'
Reacting to the speech, Scottish Labour's Deputy Leader Kezia Dugdale said it was "encouraging" that Ms Sturgeon recognised the "value of being part of a larger union".
She added: "This debate can't just be about economics or politics. It also has to be about our role in the world. We are faced with a choice between working together with nations across Europe to tackle the big challenges of our age, or cutting ourselves off from the world.
"As part of the EU we have a voice on the world stage that would otherwise be lost. Whether it's discussions about tackling climate change or our relationship with the biggest economies in the world, we have influence far greater than our size would suggest. That's something to celebrate."
However, Scottish Conservative MSP Annabel Goldie said Ms Sturgeon's speech only served to "highlight the contradictions in the SNP's policies in relation to the UK and the EU".
She added: "Whatever the cost, she wants to end our union with the United Kingdom.
"Yet, whatever the cost, it appears she wants to keep our union with the European Union.
"The first minister needs to come clean. Since she is so opposed to the UK and so supportive of the EU project, surely she should just admit that the SNP would dump the British pound and back the Euro."
UKIP MEP for Scotland David Coburn said Ms Sturgeon's double majority call was "typical SNP gerrymandering of the democratic process".
He added: "We came into the EU as one so we either stay in the EU together or we leave together.
"The Scottish people clearly decided that they wanted to remain as part of the United Kingdom so any talk of this double-lock mechanism makes a mockery of the Scottish people's decision."