The heroin program, started in 1994, is offered in 23 centers across Switzerland. It has helped eliminate scenes of large groups of drug users shooting up openly in parks that marred Swiss cities in the 1980s and 1990s and is credited with reducing crime and improving the health and daily lives of addicts.
The nearly 1,300 selected addicts, who have been unhelped by other therapies, visit one of the centers twice a day to receive the carefully measured dose of heroin produced by a government-approved laboratory.
They keep their paraphernalia in cups labeled with their names and use the equipment and clean needles to inject themselves - four at a time - under the supervision of a nurse, and also receive counseling from psychiatrists and social workers.
The aim is to help the addicts learn how to function in society.
The United States and the U.N. narcotics board have criticized the program as potentially fueling drug abuse, but it has attracted attention from governments as far away as Australia and Canada, which in recent years have started or are considering their own programs modeled on the system.
The Netherlands started a smaller program in 2006, and it serves nearly 600 patients. Britain has allowed individual doctors to prescribe heroin since the 1920s, but it has been running trials similar to the Swiss approach in recent years. Belgium, Germany, Spain and Canada have been running trial programs too.
Sixty-eight percent of the 2.26 million Swiss voters casting ballots approved making the heroin program permanent.
By contrast, around 63.2 percent of voters voted against the marijuana proposal, which was based on a separate citizens' initiative to decriminalize the consumption of marijuana and growing the plant for personal use.
Olivier Borer, 35, a musician from the northern town of Solothurn, said he welcomed the outcome in part because state action was required to help heroin addicts, but he said legalizing marijuana was a bad idea.
"I think it's very important to help these people, but not to facilitate the using of drugs," Borer said. "You can just see in the Netherlands how it's going. People just go there to smoke."
Sabina Geissbuehler-Strupler of the right-wing Swiss People's Party, which led the campaign against the heroin program, said she was disappointed in the vote.
"That is only damage limitation," she said. "Ninety-five percent of the addicts are not healed from the addiction."
Health insurance pays for the bulk of the program, which costs 26 million Swiss francs ($22 million) a year. All residents in Switzerland, which has a population of 7.5 million, are required to have health insurance, with the government paying insurance premiums for those who cannot afford it.
Parliament approved the heroin measure in a revision of Switzerland's narcotics law in March, but conservatives challenged the decision and forced a national referendum under Switzerland's system of direct democracy.
Jo Lang, a Green Party member of parliament from the central city of Zug, said he was disappointed in the failure of the marijuana measure because it means 600,000 people in Switzerland will be treated as criminals because they use cannabis.
"People have died from alcohol and heroin, but not from cannabis," Lang said.
The government, which opposed the marijuana proposal, said it feared that liberalizing cannabis could cause problems with neighboring countries.
On a separate issue, 52 percent of voters approved an initiative to eliminate the statute of limitations on pornographic crimes against children before the age of puberty.
The current Swiss statute of limitations on prosecuting pedophile pornography is 15 years. The initiative will result in a change in the constitution to remove that time limit.