The law provides immunity from simple possession charges for anyone calling 911 to report an overdose.

The Good Samaritan Drug Overdose Act was introduced as a private member's bill last year by Liberal backbencher Ron McKinnon and received royal assent on Thursday.

OTTAWA — A new federal law aims to reduce the number of people who die from opioid and other drug overdoses in Canada.

A man walks past a mural by street artist Smokey D. about the fentanyl and opioid overdose crisis, in the Downtown Eastside of Vancouver, B.C., on Dec. 22, 2016. (Photo: Darryl Dyck/The Canadian Press)

McKinnon said he was spurred to action by an epidemic of opioid overdoses in his home province of British Columbia and the rising number of deaths in Alberta and other provinces.

"It will save lives all across the country," he said in an interview, noting the bill was supported by lawmakers from other parties.

"They know that their neighbours, their communities, are facing the problem of people dying from overdoses. They understand they need to take action."

McKinnon said there have been cases where people have been afraid to call police or an ambulance for help when someone is having an overdose over fear they will be charged with drug possession.

He said it doesn't matter if it is a drug addict on the street or a middle class kid at a party. Making a simple phone call for help could save a life.

"They know that their neighbours, their communities, are facing the problem of people dying from overdoses. They understand they need to take action."

Health Canada says the law also provides an exemption from charges for people who are on a probation order, serving a conditional sentence or who are on parole.

McKinnon, the MP for Coquitlam-Port Coquitlam, said the exemption will not apply to offences such as drug trafficking or driving while impaired.

Health Canada says opioid overdoses are killing thousands of Canadians of all ages and from all walks of life.

"Protecting the lives of Canadians is our most important priority," Health Minister Jane Philpott said in a release Thursday.

"This law ensures that you can call for help when someone is having a drug overdose — and stay to provide them support until emergency responders arrive — with guaranteed immunity from certain charges related to simple possession of illegal drugs."