A vending machine for powerful opioids has opened in Canada as part of a project to help fight the Canadian city’s overdose crisis.

The MySafe project, which resembles a cash machine, gives addicts access to a prescribed amount of medical quality hydromorphone, a drug about twice as powerful as heroin.

Dr Mark Tyndall, a professor of epidemiology at the University of British Columbia, came up with the project as part of an attempt to reduce the number of overdose deaths in the city, which reached 395 last year.

“I think ethically we need to offer people a safer source,” he said. “So basically the idea is that instead of buying unknown fentanyl from an alley, we can get people pharmaceutical-grade drugs.”

Don Durban, a social worker from Vancouver, is one of 14 opioid addicts using the MySafe vending machine. After being prescribed opioid-based painkillers in the early 2000s, the father of two developed an addiction and now feels unable to cope without a daily dose of hydromorphone.

Unlike most addicts, Durban, 66, does not have to break the law by sourcing his fix through drug dealers. Instead he is prescribed Dilaudid – the brand name for hydromorphone – and, for the past couple of weeks, has been able to collect his pills from a vending machine near his home in Downtown Eastside, a rundown neighbourhood with a large homeless community.

“This is a godsend,” he told the Guardian during one of his visits to the machine. After verifying his identity with a biometric fingerprint scan, the machine dispensed Durban with three pills for each of his four daily visits, in line with his prescription.

“It means I don’t have to go and buy iffy dope,” he said. “I have a clean supply. I don’t have to deal with other people so much. You’re treated like an adult, not some kind of demonic dope fiend. We’re just people with mental health issues.”

Vancouver already has several schemes in place to accommodate for its large community of drug addicts. A pioneer of so-called harm reduction techniques, Vancouver was the first North American city to introduce a supervised injection site – where users can administer drugs in front of medical professionals – in 2003, and there are now several in the area. There are also programmes allowing users to access prescribed Dilaudid or pharmaceutical heroin.

Tyndall believes his scheme, which he hopes to roll out in other cities, will help addicts by giving them more autonomy – allowing them to pick up supplies at their convenience without having to visit pharmacies at specific times.

However, the MySafe project and Vancouver’s other harm-reduction techniques are not universally popular.

Dr Mark Ujjainwalla, an addictions doctor who runs Recovery Ottawa in eastern Canada, says users of illegal drugs need treatment for their conditions rather than easier access to substances. He argues such schemes are in effect ushering users towards death, rather than treating curable conditions.

“If you were a patient addicted to fentanyl [and you came to me], I would say: ‘OK, I will put you in a treatment centre for one to three months, get you off the fentanyl, get you stable, get your life back together and then you’ll be fine.’ Why would I want to give you free heroin and tell you to go to a trailer and inject?

“I’ve got people here who have changed their lives. They were in jail, prostituting, and they came to my clinic, we put them on methadone, they got their lives back, they’re working again. Isn’t that a better story?”

Ujjainwalla also fears drugs distributed from machines such as MySafe could end up on the black market.

Dr Ricky Bluthenthal, a professor of preventive medicine at the University of Southern California, disagrees. “It’s always better for someone to use licitly produced, safe medication rather than illicitly produced or illicitly distributed substance, which often have contaminants and other things that are unhealthy for people,” he said.

Durban also believes the machine will help him back to good health. “My long-term aim is to get off of [these drugs],” he said. “What I’ll do is try to get down to a minimal dose and then if it starts acting up again, I’ll see Mark and ask him to bring it up again.”