North Carolina’s anti-LGBT law was a key factor in Governor Pat McCrory’s defeat at the ballot box, polling has showed.

North Carolina has lost a string of big investment ventures over Republican Governor Pat McCrory’s decision to sign the contentious HB 2 – which voided all local ordinances protecting LGBT rights, banned transgender people from using their preferred bathroom, and permits businesses to discriminate against LGBT people on the grounds of religious belief.

Although Trump comfortably took the state during the Presidential election last month, an apparent split-ticket vote saw McCrory narrowly lose his re-election battle to Democrat Roy Cooper. After a month of legal challenges, McCrory finally conceded this week.

In the wake of the result, the Human Rights Campaign (HRC) and Equality North Carolina have released results of post-election polling, which shows that HB 2 was the critical issue leading to McCrory’s defeat.

57 percent of North Carolinians cited HB2 as their key reason to vote against McCrory, 17 points above any other issue, while voters were opposed to the anti-LGBT law by a 62 to 30 percent margin.

A split-ticket effect was evident, with McCrory trailing other Republicans up for election at the same time. He ran approximately 63,000 votes behind Donald Trump, 96,000 votes behind Sen. Richard Burr, and more than 225,000 votes behind his party’s own candidate for agriculture commissioner.

According to the polling, both Trump and Burr won the Independent vote by 21 points, while McCrory won by only 9 points. HB 2 was also a key issue in four state legislature races where the Democrats gained seats.

Equality NC Executive Director Chris Sgro said: “This polling data shows what we have seen and heard in our communities all over the state – HB2 is bad for North Carolina.

“Pat McCrory refused to listen to the people of North Carolina and as a result, the people stood up and ousted him out of office. That means that a champion of equality will replace one of the worst anti-LGBTQ politicians as the highest officeholder in our state. North Carolinians deserve a Governor that represents their values.

“There is much to be done in order to support Roy Cooper’s efforts to repeal HB2 and create statewide non-discrimination protections. We are looking forward to working with Governor-elect Roy Cooper to repeal the vile HB2 and restore North Carolina’s reputation.”

Meanwhile, national polling, conducted by Greenberg Quinlan Rosner Research, showed that although voters opted to put Donald Trump and Mike Pence in the White House, they don’t agree with them on LGBT rights.

The polling found that 61 percent of voters nationally now support marriage equality, compared to 50 percent after 2012.

69 percent of voters – including a 55 percent majority of Trump voters – support the Equality Act which would broaden – not contract – LGBT rights protections.

The news suggests Trump may face a backlash from his own supporters if he fulfils his pledge to sign the First Amendment Defence Act, which would instead grant license to discriminate against LGBT people on the grounds of religion.

HRC President Chad Griffin said: “This research is proof that when it comes to LGBTQ equality, hearts and minds remain forever changed and on our side. Nowhere is that more clear than in North Carolina, where voters soundly rejected Pat McCrory and sent a clear signal that anti-LGBTQ politicking is now a liability to candidates, no matter their party.

“Barely 10 years ago, Republicans – and some Democrats – running for governor were campaigning their support for state bans on marriage equality. But today, as McCrory has proven to the nation, promoting anti-LGBTQ discrimination will cost you an election. There is no doubt that Americans have moved inexorably in the direction of equality and have no appetite for hatred from their elected officials.”

Roy Cooper takes office next month.