The Democratic Governor of Montana, Steve Bullock, will sign into law a bill that decriminalises gay sex, 16 years after the state’s Supreme Court ruled it to be unconstitutional.

Gay campaigners stressed it was important to fully remove a law which once treated them as criminals.

An attempt to repeal the statute failed in 2011.

Senate Bill 107, the measure that strikes from the state code obsolete language criminalising gay sex as deviant sexual conduct, passed Montana’s lower House and Senate earlier this month.

The bill had become stuck in a Republican controlled committee until Democrat Bryce Bennett led the effort to put the measure to a vote in the House.

The measure received bi-partisan support from representatives, passing its final hurdle with a 65-34 vote a few weeks ago.

Governor Bullock plans to sign Senate Bill 107 into law on Thursday.

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

Montana still lags behind other US states when it comes to gay rights.

It adopted a constitutional amendment in November 2004 banning equal marriage rights for same-sex couples.

No provision of Montana law currently addresses discrimination on the basis of sexual orientation or gender identity and the state’s hate crimes statute does not cover violence based on both categories either.