The European Court of Justice has ruled that Dutch authorities can bar foreigners from cannabis-selling coffee shops.
The court said the city of Maastricht was within its rights when it passed a 2005 law stopping foreigners entering cafes that sell marijuana.
The law was aimed at curbing so-called drug tourists driving from Belgium and Germany to buy marijuana.
Correspondents say the government wants to extend the restrictions nationwide.
There are some 700 coffee shops in the Netherlands. The cultivation and sale of soft drugs through them is decriminalised but not legal.
The owner of a Maastricht coffee shop had challenged the 2005 law, arguing that the policy breached EU laws on free movement of goods and services.
However, Thursday's ruling said the restrictions still complied with EU law.
"That restriction is justified by the objective of combating drug tourism and the accompanying public nuisance," the court said.
It added that the governments of Belgium, Germany and France had linked drug tourism to public order problems in their own countries.
Cannabis use in the Netherlands is tolerated in small amounts, with possession and purchases limited to 5g (0.2oz) per adult, regardless of the consumer's nationality.
However, the Netherlands' centre-right coalition government plans to turn coffee shops into private members' clubs amid concerns about the threat drug tourism poses to the Dutch way of life.
The BBC's Geraldine Coughlan in The Hague says the ruling could spell the end of the country's 30-year-old soft drugs tourism trade. BBC News