After four hours of animated debate, French MPs approved a six-year testing of so-called shooting galleries ("salle de shoot") for drug addicts in Paris and in at least two other cities.
The legislation is part of the new health bill and was approved by 50 votes to 24.
Health Minister Marisol Touraine, who first proposed the idea back in 2013, argued that shooting galleries were more hygienic environments for drug addicts, claiming they reduce the risks of infections and contamination of diseases such as HIV and hepatitis C, which spread through the use of dirty needles.
Drug addicts would be allowed to take illegal drugs,up to a limit, without being arrested. The centres would be supervised by doctors, health professionals, and specialist help teams.
The motion was supported by MPs from the left but was opposed by many in the centre-right UMP opposition party, who fear a first step towards the legalization of drugs. They advocate abstinence as the only solution to help drug addicts give up their addiction.
"We should be helping drug addicts to get clean rather than helping them to self-destruct. Why not call these shooting galleries death rows instead?" right-wing UMP deputy Philippe Goujon told the National Assembly.
When the idea was first put forward two years ago, UMP party secretary Camille Bedin said: "If one of these centres opens up then families living near by will suffer from the scourge of drug trafficking."
In May 2013, authorities named the location for the first drug "safe house" for addicts. It was set to be at 39 Boulevard de la Chapelle, just behind Gare du Nord, in one of the capital's more impoverished neighbourhoods.
However the plan to open the "shooting gallery" in September that year was finally ditched in November with authorities preferring to wait until a law was in place.
Switzerland was the first country to open shooting galleries in the 1980s and since then other European countries including Germany, Spain, the Netherlands, Norway, Luxembourg and Denmark have introduced the measure.
By Chloé Farand