CHICAGO — Starting in January, Illinois will bar a rare criminal defense allowing the use of a victim’s sexual orientation as justification for violent crime, a ban gay rights advocates say they will attempt to replicate in about half a dozen states next year.

Defense attorneys will no longer be able to mount the so-called “gay panic defense” in Illinois, the second state after California to prohibit the tactic. It isn’t common, but one study shows it has surfaced in about half of all U.S. states and has been used with some success. Advocates say bans are necessary because crimes against gay and transgender people are on the rise, but some attorneys remain skeptical, calling the ban politically motivated and unnecessary because the old-fashioned defense wouldn’t hold up in court today.

In this June 11, 2017 file photo people attend the LGBTQ Chicago Equality rally in the Andersonville neighborhood of Chicago. Brian Cassella / Chicago Tribune via AP File

After a lackluster attempt in 2016, the Illinois ban sailed through the Legislature in May with no opposition and Republican Gov. Bruce Rauner signed it into law without comment. Supporters called it a major victory for LGBTQ rights — especially as advocacy groups including the Human Rights Campaign report spikes in murders of transgender people — that could provide momentum for change elsewhere.

“For us, it was important to eradicate (the defense), regardless of use,” said Brian Johnson, the CEO of Equality Illinois, which backed the ban. “It makes our identity sufficient reason for murder. We never wanted it to be used going forward.”

There are variations, but it generally goes like this: A person doesn’t realize someone is gay or transgender and engages in a flirtation, then discovers that person’s sexual orientation and that discovery triggers a passionate involuntary response such as murder.

Advocates point to the beating death of Islan Nettles, a transgender woman who died on a New York City street in 2013. James Dixon, who pleaded guilty and was sentenced last year, flirted with Nettles before realizing she was transgender. He punched her in the face and she fell and hit her head.

Legal experts including Anthony Michael Kreis, a Chicago-Kent College of Law professor who helped write the Illinois law, said Dixon got a lenient 12-year prison sentence in a plea deal because of the “trans panic” defense. Dixon has said he doesn’t hate transgender people.

Supporters plan to revive legislative attempts to ban what’s also known as the “trans panic” defense, in statehouses in Washington and New Jersey, where proposals haven’t yet received committee votes. Advocates also hope to make inroads in New York, Maryland, Michigan, Minnesota and Texas.

In this June 11, 2017 file photo, people attend the LGBTQ Chicago Equality rally in the Andersonville neighborhood of Chicago. Brian Cassella / Chicago Tribune via AP File

“The gay and trans ‘panic’ defenses are outdated relics reminiscent of a time when widespread antipathy was commonplace for LGBT individuals. It asks jurors to find that a victim’s sexual orientation or gender identity excuses the actions of a violent criminal,” said D’Arcy Kemnitz, the National LGBT Bar Association’s executive director. “Our nation’s courtrooms cannot truly be places where law rules supreme while these defenses are still allowed to persist.”

Such “panic” defenses have come up in court opinions in about half of U.S. states since the 1960s, according to a 2016 study by the Williams Institute at the University of California Los Angeles’ law school. But the defense is hard to track and identify. No state recognizes it as a free-standing defense in the criminal code and it’s often used in conjunction with insanity or self-defense claims.

The American Bar Association called for a prohibition in 2013. California outlawed the defense in 2014.

Kreis called the Illinois law a “remarkable” win and perhaps the first unanimous roll-call vote in a statehouse on a gay and transgender issue. But while no one voted “no,” over two dozen legislators — Democrats and Republicans — didn’t vote. Their reasons varied from non-attendance to human error.

In this Aug. 2, 2012 file photo, Chicago defense attorney Steve Greenberg speaks to the media in Joliet, Ill. M. Spencer Green / AP Photo

Chicago defense attorney Steve Greenberg, who represented former police officer and convicted killer Drew Peterson, said the ban wouldn’t have much practical effect in courts where the defense is hardly used.

“That’s just not a defense,” he said. The legislation is “political pandering and window dressing.”

The last time the defense came up in Illinois was in two suburban Chicago murder cases, but the 2009 court proceedings illustrate divided opinion on the tactic.

In one, Joseph Biedermann of Hoffman Estates admitted killing Terrance Hauser, who was stabbed over 50 times. Biedermann said Hauser threatened to sexually assault and kill him. He was acquitted. Advocates say the “gay panic” defense was in play, but Biedermann’s attorney called it self-defense.

In another, Timothy Bailey-Woodson pleaded guilty in the murder of Bloomingdale mechanic David Coungeris, receiving a 25-year sentence. Prosecutors said Bailey-Woodson claimed he killed Coungeris after the mechanic made sexual advances toward him. Bailey-Woodson’s public defender declined comment on that aspect, but argued at the time that his client was abused as a child.

Attorney Kathleen Zellner, who has won several high-profile wrongful conviction cases, supports the ban, but says the defense wouldn’t survive in court.

“Most attorneys would find it very flawed,” she said. “I would never stand in front of a jury and try to get somebody acquitted on a first-degree murder charge with that.”