There are all kinds of defenses you could claim for certain crimes. Some are pretty basic, like "you got the wrong guy," or "it was an accident." Some are a bit more complicated and depend on the nature of the crime and the victim. The "heat of passion," which argues that a person in a sexual relationship was so blinded by jealousy that they couldn't help but commit a crime like assault or murder. Such defenses don't always exonerate a defendant, but they may lead to lesser charges.
A related defense, though based on bigotry, is the so-called "gay panic" defense. Although not a complete defense to criminal liability, the gay panic defense asks for a defendant's behavior (including assault and murder) to be partially excused based on the victim's LGBT status. Several states have been passing legislation that bars defendant's from claiming gay panic as a defense, and the District of Columbia is currently considering two such bills right now.
As described by the LGBT Bar:
The LGBTQ+ panic defense strategy (also called the "gay panic defense" or "trans panic defense") is a legal strategy that asks a jury to find that a victim's sexual orientation or gender identity/expression is to blame for a defendant’s violent reaction, including murder. It is not a free-standing defense to criminal liability, but rather a legal tactic used to bolster other defenses. When a perpetrator uses an LGBTQ+ panic defense, they are claiming that a victim’s sexual orientation or gender identity not only explains -- but excuses -- a loss of self-control and the subsequent assault. By fully or partially acquitting the perpetrators of crimes against LGBTQ+ victims, this defense implies that LGBTQ+ lives are worth less than others.
The defense was unsuccessfully employed by one of Matthew Shepard's attackers, who claimed Shepard made sexual advances that sent him into a rage. The LGBT Bar notes that the panic defense has been used to lessen charges in similar cases, and when defendants have discovered a victim's transgender status.
Thus far, California, Connecticut, Hawaii, Illinois, Maine, Nevada, New York, and Rhode Island have already banned the gay panic defense or trans panic defense, and a few other states are considering bills to do the same. The D.C. Council is looking at two similar bills:
Hearings on both bills are expected next month.