The House in the US State of Montana has voted in support of a bill to remove a law which makes gay sex a crime.

The House held its third and final vote on SB107, which will repeal the state’s sodomy law, that for years was condemned by many as being unconstitutional.

Voting 64 to 36 for the law meant victory for the bill’s supporters, and those seeking the repeal of the law.

LGBT rights activists, however, were shocked that 36 of Montana’s lawmakers wanted gay sex to remain legally defined as “deviate sexual relations,” a felony which carries a penalty of up to 10 years in prison and a fine of $50,000 (£32,000).

The statute in question prohibits “deviate sexual relations”, which it defines as: “sexual contact or sexual intercourse between two persons of the same sex or any form of sexual intercourse with an animal.”

In 1997 the Montana Supreme Court ruled the anti-gay element of the law unconstitutional, which was backed up by a judgement by the United States Supreme Court on all state “anti-sodomy” laws in 2003.

However, the statute remains in Montana law as previous attempts to change it have failed, with a similar bill to SB107 failing to get past the House Committee in 2011.

The Montana Republican Party continued to officially back the anti-gay law until as recently as 2010, stating: “We support the clear will of the people of Montana expressed by legislation to keep homosexual acts illegal.”

The bill will now head to Montana Governor Steve Bullock’s desk for his signature into law.

One supporter of the bill, Representative Duane Ankney, said the law as it stood prior was an “embarrassment”, speaking of his lesbian daughter, and his desire to protect her.

He said: “I raised five kids. The oldest is a daughter and I got four sons — three of them are veterans. And them four sons would give their last breath for my daughter to live her life in the way she chooses. To say she is any less of a person or she is a criminal for her lifestyle really upsets me. And for anybody that would feel that way upsets me.

“I don’t think God thinks any less of my daughter than he does of any one of you in here. This bill is an embarrassment — the law is an embarrassment on the good people of Montana. It should go away and should go away as quietly as it can.”

Other Representatives used the opportunity to voice their opposition to gay rights, some said they did not support equal marriage, but that gay couples deserved to not be considered criminals.

Three US states still currently hold laws which criminalise gay sex, and ten others still criminalise sexual acts such as anal and oral sex.