The Supreme Court in Canada has unanimously rejected an attempt by the government to close the only facility in North America where addicts may legally inject drugs.
The court has ruled that closing the Insite Centre in Vancouver, British Columbia - would violate the constitutional rights of the users by threatening their health and their lives.
The facility opened in Vancouver in 2003 with a federal exemption permitting illegal drug use.
Supporters say it has helped prevent overdoses, reduced infections, and curbed crime and open drug use.
But the federal government said in 2008 that it should close, arguing it promoted addiction.
The Supreme Court issued a unanimous 9-0 decision on Friday.
The BBC reports the ruling could pave the way for similar facilities to open in other parts of Canada.
Health Minister Leona Aglukkaq said the government would review the court's decision.