RICHMOND, Va. (AP) — Virginia lawmakers passed a bill that will ban the use of a person’s perceived or actual sexual orientation or gender identity as a defense in court for the assault or murder of an LGBTQ person.

“It’s done: We’re banning the gay/trans panic defense in Virginia,” Del. Danica Roem, D-Manassas, said in a Twitter post.

Roem introduced House Bill 2132, which passed the Senate 23-15 on Thursday with an amendment. The House approved the amendment in a 58-39 vote. The bill now heads to Gov. Ralph Northam’s desk for a signature.

The Senate amendment adds oral solicitation, or hitting on someone, as an unacceptable justification for the gay or transgender panic defense.

The panic defense has historically been used in cases where a member of the LGBTQ community was attacked because of their actual or perceived sexual orientation or gender identity. Defendants use the panic defense to justify “heat of passion” murders or assaults.

“This (bill) means someone’s mere existence as an LGBTQ person does not excuse someone else and does not constitute a reason of provocation to commit such a heat of passion attack,” Roem said.

The statute does not dismiss traditional self-defense lawsuits. This means LGBTQ people can still be prosecuted for attacking someone.

There have been at least eight instances in Virginia where the panic defense was used, with the last case in 2011, according to Carsten Andresen, a researcher and criminal justice professor from Austin, Texas. He said he has tracked 200 homicide cases nationally where the panic defense was attempted. Andresen reached out to Roem in support of the bill.

His research included five murders and three assaults in Virginia between 1973 and 2011 that Andresen said used the panic defense to justify or excuse a defendant’s violent actions. Mark Hayes murdered Tracie Gainer, a transgender woman, in 2002. Hayes claimed he “lost it” and murdered Gainer after engaging in sexual intercourse.

In 2011, Deandre Moore, age 18, pleaded guilty to killing 20-year-old Jacques Cowell by stabbing him multiple times. Cowell was openly gay and there were witness accounts that the two had a physical relationship. Moore received a 40-year prison sentence, with 15 years suspended.

“In these cases, criminal defense attorneys used gay and trans panic defense to put the victim (rather than the offender) on trial,” Andresen wrote in support of the bill. He said use of the panic defense “suggests that it is permissible to commit violence” against LGBTQ people.

Sen. Joseph Morrissey, D-Richmond, spoke in opposition of the bill, saying lawmakers should not pass laws that prohibit defendants from making a defense and that lawmakers would be going “down a very slippery slope.” Morrissey said any defendant who would offer the panic defense “would of course be rejected.”

Sen. Jennifer McClellan, D-Richmond, said this is not the first time Virginia has expressly prohibited a defense. Legislators repealed in 2008 the code section that provided defense from carnal knowledge when a defendant marries a child 14 years or older.

“When we have found an affirmative defense to be abhorrent to public policy we have gotten rid of it,” McClellan said.

McClellan said she wished she could agree with Morrissey that no judge would accept the panic defense, but referred back to the Virginia cases where it was used successfully.

“We know the bill is constitutional, we know also, the bill has existing precedence, which is why it has earned overwhelming bipartisan support in state houses across the country,” Roem said.

The American Bar Association in 2013 recommended that local, state and federal legislatures curtail the availabilty and effectiveness of the gay and transgender panic defense. Roem said that similar bills have been implemented in other state legislatures. Virginia will become the 12th state to ban the panic defense, according to the policy organization Movement Advancement Project. The defense is also banned in the District of Columbia.

There are currently 39 states that allow the panic defense to be used in cases where hate crimes resulted in the assault or murder of an LGBTQ individual. This typically results in a murder charge being lessened to a charge of manslaughter or acquittal.

Roem said she worked with Wes Bizzell, president of the National LGBT Bar Association, to prepare the bill. She also thanked Judy Shephard, the mother of Matthew Shephard, for speaking in support of the bill in committee.

Matthew Shephard, a gay man, was murdered in 1998 in Laramie, Wyoming. The judge barred Aaron McKinney’s defense lawyer from using the gay panic defense in the murder trial. McKinney said Shepard’s advances triggered memories of sexual abuse he suffered as a child. Police said the crime was motivated by robbery, but Shepard’s sexual orientation likely made him the target. There were four people involved in the brutal crime. Two were found guilty of murder and two were charged with being an accessory after the fact to first-degree murder.

Roem was in high school when Matthew Shephard was murdered. She said the case had a profound effect on her and prevented her from coming out due to a fear of being ostracized and attacked.

“It was requested to me by one of my Manassas Park student constituents who’s out, hoping not to have to live in the same fear in 2021 that I did in 1998,” Roem said of the bill.

Roem said there are people who don’t believe hate crimes such as the one against Shephard happen today in Virginia. She affirmed that they do happen, and she believes it is time to do something about it.

“We have to look at this from the perspective of ’what do we do to make an affirmative statement that LGBTQ lives matter, and that you can’t just kill us for existing,” Roem said.