New South Wales has repealed a law which allowed murderers to get off with a lighter sentence if they claimed a gay victim ‘provoked’ them into the attack.

On Wednesday, the New South Wales parliament finally passed the Crimes Amendment (Provocation) Bill, which removes the ‘gay panic’ legal defence from statute.

The law, similar to one still in place in Queensland, allowed murderers far more lenient sentences if they claimed they had been subject to an unwanted sexual advance from a victim, and were panicked into killing them.

Gay rights lobbyist Justin Koonin said: “The Bill effectively removes the legal foundation for the use of the Homosexual Advance Defence, a common-law creation of the partial defence of provocation, in cases involving a non-violent sexual advance.

“We’ve fought for years to end this homophobic and bi-phobic legislation and we welcome the passage of this Bill.

“It sends a strong message that violence against people because of their sexual orientation is unacceptable and will certainly not be accepted as an excuse for murder.”

According to Same Same, the law has only ever been used in cases involving two males.

‘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.