Gov. Dannel P. Malloy has signed legislation that grants civil and criminal liability protection to a bystander who administers naloxone hydrochloride — known as Narcan — in good faith to someone who has overdosed.

The governor’s office said the new law is focused on reducing fatalities resulting from heroin and prescription drug overdoses. Narcan is a prescription medication that reverses an opioid overdose by restoring stimulating the respiratory system. It can be administered by a layperson with minimal training and is most commonly available as either an injection or nasal spray.