The Governor of California has signed a law outlawing the use of the so-called ‘gay panic’ defense.

The defense – which is often used to get more lenient sentences for criminals after assaults and murders – is based around the claim that a perpetrator was “panicked” into committing a violent crime due to an unwanted advance from a gay person.

More recently, the panic defense has also been used to justify crimes against transgender people after discovering their gender identity.

Rights campaigners have long argued that it is deeply homophobic, and last month a bill axing it was passed by the state assembly by a vote of 50-10.

It was yesterday signed into law by Governor Jerry Brown, making California the first state in the US to expressly outlaw it.

Jordan Blair Woods, a law fellow at the Williams Institute UCLA said: “The gay and transgender panic defenses did not appear until the late 1960s, and rely on outdated ideas that homosexuality and gender non-conformity are mental diseases.

“Since then, the defense has appeared in court opinions in approximately one-third of the states.”

Brad Sears, Executive Director of the Williams Institute, added: “This bill not only changes the law in California, but creates a model for other states to follow to eliminate the use of gay and transgender panic defenses in other states.”

‘Gay panic’ defences still exist in varying forms around the world, and in 2009 a man was acquitted of a double murder in Spain, after he claimed he burned down the home of an engaged gay couple due to “an unbearable fear”.

The best-known case of the gay panic defence was in the murder of US student Matthew Shepard.

He was killed in October 1998 on the outskirts of Laramie, Wyoming, by two men he had met in a bar.

Local residents Aaron McKinney and Russell Henderson, both 21 at the time, were charged with his murder.

They told the prosecution they suffered “a moment of insanity” when he allegedly made sexual advances to him.

Shephard was robbed, beaten and left to die tied to a fence.

Both men are serving consecutive double life sentences.