Liberals had few victories to celebrate Tuesday night, but in North Carolina, they’re claiming one: The state’s incumbent governor, Republican Pat McCrory, lost his bid for re-election to state Attorney General Roy Cooper, a Democrat.

The final numbers aren’t in, but the outcome looks clear. By all accounts, McCrory should have had the election in the bag—in nearly all other cases, the state went red.

But McCrory, an otherwise successful governor, became the face of one of the nation’s most controversial pieces of legislation to pass this year: House Bill 2.

The law, formerly known as the Public Facilities Privacy and Security Act, mandates that individuals use restrooms and locker rooms in schools, public universities, and other government buildings based on the gender listed on their birth certificates. Because of its nature, the measure became known as “the bathroom bill.”

North Carolina Governor Pat McCrory tells supporters that the election results of his contest against Democratic challenger Roy Cooper will be contested, while his wife Ann looks on, in Raleigh, North Carolina on Nov. 9, 2016. (Photo: Jonathan Drake/Reuters)

North Carolina Gov. Pat McCrory, with his wife Ann in Raleigh on Nov. 9, tells supporters he will contest the results of his contest against Democratic challenger Roy Cooper.  (Photo: Jonathan Drake/Reuters/Newscom)

In March, the North Carolina Legislature pushed through the bathroom bill and McCrory signed it the same day. The action followed the city of Charlotte’s passage of an ordinance allowing transgender individuals to use public restrooms and locker rooms based on their gender identity.

The state law provides an exception for individuals who underwent sex-reassignment surgery and took legal steps to change the gender specified on their birth certificates.

The law faced immediate, bitter backlash from national and state advocates for lesbian, gay, bisexual, and transgender Americans, and McCrory had to answer to it.

U.S. Attorney General Loretta Lynch threatened to withhold public education funds from North Carolina schools, stating the law violated the Civil Rights Act and Title IX, which bans discrimination based on sex.

After that, McCrory went on offense. The governor filed a lawsuit against the federal government, arguing the Obama administration had no right to tell public schools in North Carolina who could and couldn’t use the girls’ locker rooms.

The federal government countersued, and since then, the debate over how to balance the needs of transgender students with the safety and privacy concerns of the rest of the student body has only grown. Across the country, more than a dozen lawsuits are in play, and in October, the Supreme Court announced it would take on the issue next year.

Viewing the bathroom fight as one of the most important battles of 2016 for the lesbian, gay, bisexual, and transgender movement, known as LGBT, the national Human Rights Campaign got involved. In partnership with the state group Equality North Carolina, the group said, it rallied more than 255,000 LGBT voters across the state.

Their target? Gov. Pat McCrory.

“Pat McCrory: Bad for business, bad for North Carolina,” reads one of the group’s campaign ads.

The financial impact of House Bill 2 became one of the left’s main talking points. Democrats claimed the measure cost $500 million in lost business.

Losses, indeed, were a new reality for the state. The NCAA relocated several championship tournament games from the state, the National Basketball Association pulled its annual All-Star game from Charlotte, and the Atlantic Coast Conference moved its championship games.

Musicians Bruce Springsteen, Pearl Jam, Nick Jonas, and Demi Lovato, among others, canceled North Carolina concerts in protest of the law. Production companies pulled their business from the state.

The damage, however, is hotly disputed. A review by The Charlotte Observer estimated the North Carolina economy lost somewhere between $77 million to $201 million.

McCrory’s commerce secretary, John Skvarla, said in an October speech that the new law “hasn’t moved the needle one iota” in regard to the economy.

Under McCrory’s leadership, North Carolina had a strong economic performance in 2015, ending with a total gross domestic product around $500 billion. Even if the $500 million were precise, the governor’s backers say, the damage is a drop in the bucket.

Nevertheless, LGBT groups continued their narrative that House Bill 2 is “bad for business,” and right now they’re celebrating a victory.

Chad Griffin, president of the Human Rights Campaign, and Chris Sgro, executive director of Equality North Carolina, called the early unofficial results of the governor’s race “historic” and a “beacon of hope for equality.”

“Tonight, voters said that HB 2 and the politics of hate have no place in the state of North Carolina,” they said in a written statement, adding:

As businesses and jobs fled the state and McCrory’s poll numbers fell, anti-equality groups rallied to his side, spending millions of dollars to bolster his faltering campaign. And we met them head on. Through our TurnOUT NC campaign, we launched the largest voter mobilization effort in our organizational histories.

The outcome, Griffin and Sgro argued, is “a wake-up call” for any lawmaker considering such measures:

By electing Roy Cooper their next governor, North Carolinians have sent a powerful message across their state and this country that the days of anti-LGBTQ politicians targeting our community for political gain are over. While McCrory may have been surprised by the overwhelming opposition in this state and across the country to his discriminatory politics, the same will not be true for lawmakers who are considering doubling down on anti-LGBTQ extremism in the future. This is a wake-up call.

However, some say the effort LGBT groups had to put in to achieve an essential tie in the governor’s race actually demonstrates that measures such as HB 2 stand a chance. Aside from the governor’s race, the state voted overwhelming Republican, electing a supermajority in both the state House and Senate.

Michael Needham, chief executive officer of  Heritage Action for America, the lobbying arm of The Heritage Foundation, told The Daily Signal:

In a year that saw the election of a president committed to signing legislation protecting religious freedom in the United States and the preservation of a Senate majority to help shepherd judicial nominees who respect the Constitution to the bench, the left managed to win a coin-toss election for governor of North Carolina. That’s not a mandate to repeal HB 2—if it were, the people of North Carolina would not have elected a veto-proof majority of Republicans to the state Legislature.

Tami Fitzgerald, executive director of the conservative North Carolina Values Coalition, has been on the ground fighting in favor of HB 2 since it passed in March. She, too, said efforts of groups such as the Human Rights Campaign were less than effective.

“The people of North Carolina have already spoken through the unusually big wins that the Legislature obtained last night,” Fitzgerald said in a phone call. “They have huge, veto-proof majorities that the Human Rights Campaign and Equality North Carolina were not able to take away through this false narrative they’ve created on House Bill 2.”

On the campaign trail, Republicans weren’t shy in promoting the most socially conservative national platform in history.

The national Republican Party’s 2016 platform rejects the Supreme Court’s Obergefell v. Hodges decision, which legalized same-sex marriage. It also supports “the appointment of justices and judges who respect the constitutional limits on their power and respect the authority of the states to decide such fundamental social questions.”

Perhaps most relevant to the North Carolina election, the Republican platform rejects the left’s interpretation of Title IX, which is the basis of the transgender restroom debate.

Title IX is the federal statute that bans discrimination on the basis of sex. The Obama administration has said Title IX applies to gender identity, while conservative-leaning courts have ruled otherwise.

While the bathroom law may have sunk McCrory’s re-election bid, those results don’t serve as a referendum on the measure itself, Fitzgerald said.

“Whichever way the governor’s race goes,” she said, “states could interpret this as a clear signal that you can stand up to the Human Rights Campaign and win.”