A California bill looking to ban gay and transgender “panic” defenses in court is headed to the governor.

The defenses are used in murder and hate crime trials to claim that the perpetrator panicked and committed the crime due to the victim’s sexual orientation or gender identity.

The bill, headed to Democratic Governor Jerry Brown, was approved by the state assembly in a 50-10 vote Wednesday.

Current California law states murder charges can be reduced to manslaughter charges if the murder occurred in the heat of passion or in a suddenly-provoked quarrel.

In an anti-gay stabbing in New York last year, the suspect used the gay panic defense after being charged with a hate crime.

A man suspected of assaulting two transgender women on an Atlanta train in June used the panic defense, claiming he attacked the women because they came on to him.