HARTFORD, Conn. (AP) — Criminal defendants in Connecticut would be barred from claiming as their sole legal defense that they panicked after learning about their victim's sexual orientation under a bill heading to the governor's desk.

The state House of Representatives unanimously passed a bill Tuesday that prevents defendants from using the so-called gay panic defense. That defense blames a violent reaction on discovering a victim's actual or perceived sexual orientation or gender identity or expression.

Rep. Rep. Raghib Allie-Brennan, a Democrat from Bethel, made note of the 1998 death of Matthew Shepard, the college student who was beaten to death by two men in Wyoming. Defense attorneys unsuccessfully attempted to use the gay panic defense. A judge would not allow it and those men were convicted.

"It's a very important case that we should not forget about," said Allie-Brennan, noting the recent increase in the number of reported hate crimes the U.S. According to the FBI, the number increased by about 17% in 2017.

"People don't know what it's like to walk down a street and look behind your back and wonder, 'is someone offended by me? Does someone not like me? What are they going to do to me?'" he said.

Democratic New York Gov. Andrew Cuomo has called on lawmakers in that state to pass similar legislation this year that ensures people who attack or kill a gay person can't attempt to excuse violent attacks by arguing they were under extreme emotional distress because of their victim's sexual orientation. The legislation before New York lawmakers would state that such an excuse cannot be considered a "reasonable explanation" for a violent crime.

Cuomo said the bill is one of his top priorities before the Legislature adjourns June 19.

According to the Washington, D.C.-based National LGBT Bar Association, which is leading an effort to pass such legislation across the country, said California, Illinois, Rhode Island and Nevada have already banned gay panic defenses. Legislation is pending in other states.