Those accused of murder in New Jersey can no longer legally argue a person’s sexuality or gender identity provoked them to commit the crime under a new law banning “gay panic” defenses signed by Gov. Phil Murphy on Tuesday.

The “gay panic” defense allowed those charged with murder to seek a downgraded offense of manslaughter if they committed the act “in the heat of passion” upon provocation from a gay or transgender person.

A "heat of passion” manslaughter carries a five to 10-year prison sentence, but a murder conviction can result in 30 years to life behind bars.

“We will always stand with our LGBTQ+ community and promote full equality for all our residents,” Murphy, a Democrat, said in a statement. “Gay and trans panic defenses are rooted in homophobia and abhorrent excuses that should never be used to justify violence against vulnerable populations. With this new law, we are enacting critical measures to protect our friends and neighbors in the LGBTQ+ community.”

Both houses of the New Jersey Legislature voted overwhelmingly voted to pass the bill (A1796). It passed 39-0 in the state Senate and 76-0 in the state Assembly.

Fewer than 10 other states have outlawed the defense. A New Jersey man found guilty of murder in 2011 tried to use the defense upon appeal, but was not successful.

“Gay and trans panic defenses, which reduce the punishment for horrible crimes, amount to legal malpractice and cannot be allowed to stand,” state Sen. Joe Lagana, D-Bergen, a sponsor of the measure, said in a statement. “Discrimination of any kind has no place in New Jersey, and we will to fight for all of our residents, especially during this period of increased discrimination, to ensure that our state is safe for everyone.”

Amanda Hoover can be reached at ahoover@njadvancemedia.com. Follow her on Twitter @amandahoovernj. Find NJ.com on Facebook.

Get the latest updates right in your inbox. Subscribe to NJ.com’s newsletters.