The European Court of Justice (ECJ) has ruled the Scottish Government's plan for a minimum alcohol price would breach European Union (EU) law if alternative tax measures could be introduced.
Judges at the Luxembourg court concluded a tax rise on alcoholic drinks "is liable to be less restrictive of trade" than the proposal of a minimum unit price of 50p.
They said it was ultimately for domestic courts to determine whether alternative measures would be as effective in achieving the stated public health benefit.
The case will now be referred back to the Court of Session in Edinburgh for a final decision in the new year.
First Minister Nicola Sturgeon welcomed the ruling and insisted minimum pricing remained the "most effective way of tackling alcohol misuse".
The Scotch Whisky Association (SWA), which launched the legal challenge alongside European wine and spirits producers, said the ECJ had confirmed its view the policy would be illegal.
Health charities accused the SWA of "blocking the democratic will" of the Scottish Parliament, which passed legislation to introduce minimum pricing in 2012.
The legal challenge was initially rejected by judge Lord Doherty at the Court of Session in 2013 but was referred to the ECJ last year after an appeal hearing.
In its judgment, the ECJ said: "It is ... for the referring court, which alone has available to it all the matters of fact and law pertaining to the circumstances of the main proceedings, to determine whether a measure other than that provided for by the national legislation at issue in the main proceedings, such as increased taxation on alcoholic drinks, is capable of protecting human life and health as effectively as that legislation, while being less restrictive of trade in those products within the European Union."
The Scottish Government does not have the power to raise taxes on alcohol, with this ability reserved to Westminster.
Health Secretary Shona Robison said: "This ruling from the Court of Justice of the European Union indicates, importantly, that it will be for the domestic courts to take a final decision on minimum unit pricing.
"While we must await the final outcome of this legal process, the Scottish Government remains certain that minimum unit pricing is the right measure for Scotland.
"We believe it is the most effective mechanism for tackling alcohol misuse and reducing the harm that cheap, high-strength alcohol causes our communities."
SWA chief executive David Frost said: ''The court has confirmed that minimum unit pricing (MUP) is a restriction on trade and that it is illegal to choose MUP where there are less restrictive ways of achieving the same end.
''This ruling opens the way to moving the debate on and allowing us to address alcohol misuse with practical measures that actually work. "
Alison Douglas, chief executive of health charity Alcohol Focus Scotland, said: ''Alcohol taxes are limited in their ability to raise the price of the cheapest alcohol to a level that will actually reduce harm whereas minimum pricing is a targeted measure which will make the cheapest, strongest products less affordable to heavy drinkers who are most at risk of harming themselves and others.
''In taking legal action against the Scottish Government, the Scotch Whisky Association has blocked the democratic will of the Scottish Parliament and sacrificed public health to protect their members' profits.''
Dr Peter Bennie, chair of British Medical Association (BMA) Scotland, said: ''Every year of delay carries with it a human cost in lives lost and health damaged.
''The need to implement minimum pricing remains as pressing as ever and those who have sought to delay it in the courts have failed to act in the public interest.''
Eric Carlin, director of Scottish Health Action on Alcohol Problems, said: "Taxation increases, incidentally, are also consistently opposed by the opponents of MUP.
"We hope that the Scottish courts will now move quickly to gather evidence to conclude this case and that the Scottish Government will then implement this key policy without delay."