Gov. Roy Cooper of North Carolina. AP Photo/Gerry Broome, Pool North Carolina voted to repeal its "bathroom law" on Thursday in a compromise that saw bipartisan support but angered LGBT advocates who say the deal doesn't go far enough to stop discrimination.

The new bill, engineered by North Carolina's Republican leadership and supported by Democratic Gov. Roy Cooper, passed by 32 to 16 in the state Senate and 70 to 48 in the state House. Cooper announced in a Thursday-afternoon press conference that he had signed it into law.

It erases the law known as HB2, which curbed legal protections for LGBT people and barred transgender people from using the public bathroom that aligns with their gender identity.

Two provisions of the repeal, however, prompted objections from some Democratic lawmakers — one that leaves all matters related to bathroom regulation to the state and another that prevents local governments from enacting certain LGBT protections until the end of 2020.

"It's not a perfect deal, but it repeals House Bill 2 and begins to repair our reputation," Cooper said Wednesday night.

But Cooper came under fire from LGBT-rights groups and some Democrats, who have maintained that anything less than a full repeal of HB2 with no strings attached amounts to state-sanctioned discrimination.

"This new law does not repeal HB2," Chad Griffin, the president of the Human Rights Campaign, said in a statement Thursday before Cooper signed the bill.

"Instead, it institutes a statewide prohibition on equality by banning nondiscrimination protections across North Carolina and fuels the flames of antitransgender hate," he added. "Each and every lawmaker who supported this bill has betrayed the LGBTQ community."

The American Civil Liberties Union had also urged Cooper to veto the bill earlier Thursday.

"Rather than ending the discrimination endured by LGBT North Carolinians for the last year as a result of HB2, this bill preserves it," the ACLU's policy director, Sarah Gillooly, said in the statement. "In so doing, it marginalizes and stigmatizes an already incredibly vulnerable population, and perpetuates a harmful myth that transgender individuals are to be feared rather than accepted."

Opponents of North Carolina's HB2 law limiting bathroom access for transgender people protesting in the gallery above the state's House of Representatives chamber in Raleigh, North Carolina, on December 21. Thomson Reuters The four-year moratorium on LGBT protections, Gillooly said, "ties the hands of local governments who would otherwise have the ability to pass ordinances that make sense for their communities."

Legislators were under fierce public pressure to repeal HB2 since Tuesday, when reports indicated that the NCAA imposed an ultimatum on the state: Repeal the law within 48 hours, or miss out on the chance to host 133 championship sports events over the next five years.

HB2 has already cost the Tar Heel State an estimated hundreds of millions of dollars since it was passed just over one year ago. Earlier this week, an Associated Press analysis pegged the law's economic impact as nearly $4 billion over the next 12 years — a combination of money lost from frozen business expansions, canceled concerts, relocated sporting events, and boycotts.

It is unclear whether the replacement bill goes far enough to please the NCAA, which said earlier this month that HB2 did not assure "a safe, healthy, discrimination-free atmosphere for all those watching and participating in our events." An NCAA representative did not respond to a request to comment.

Several lawmakers expressed frustration with the rushed nature of the repeal process, which they framed as a government bowing to NCAA pressure. The compromise bill was introduced late Wednesday night, allowing virtually no time for public input before the NCAA's deadline.

Unlike many recent votes on social issues in North Carolina, Thursday's deal did not fall along party lines. Progressive Democrats in the legislature were afforded the rare experience of voting with hardline conservatives, many of whom represent safe Republican districts and had no incentive to do away with HB2.

A museum manager, Jeff Bell, installing a gender-neutral sign in the 21C Museum Hotel public restrooms on May 10 in Durham, North Carolina. Sara D. Davis/Getty Images During floor debate on Thursday, some Republicans made clear their contempt for Charlotte, North Carolina's biggest city, which passed LGBT protections last year and spurred the Republican-led legislature to override them with HB2. The bathroom law was never about discrimination, state Rep. Jeff Collins said, but "reining in rogue cities" that try to set policy for the state.

Another opponent, Republican state Rep. Bert Jones, cited his belief that God "created us male and female" as justification for keeping HB2 on the books.

Other Republicans have maintained that HB2's bathroom provision protects women and girls from sexual predators who might pose as transgender to gain access to their bathrooms. Pat McCrory, the Republican governor who signed the bill into law last year, called Charlotte's original antidiscrimination ordinance "social engineering."

McCrory's support for HB2 was widely seen as having contributed to his loss to Cooper in November's election. President Donald Trump, a Republican, carried the state relatively easily, and Republican US Sen. Richard Burr safely won reelection there, yet Cooper still edged his Republican rival by about 5,000 votes.

In December, Democrats — under direction from the newly elected Cooper — rejected a similar proposal that would have repealed HB2 and enacted a six-month moratorium on local LGBT ordinances.

Thursday's outcome leaves the governor in a precarious position, as his signature could be seen as selling out the base that lifted him to the state's highest office.

"This was the first real test of leadership for Gov. Cooper, a Democrat, and he failed spectacularly by inexplicably discarding his earlier promise not to accept any deal that left people vulnerable to discrimination," the Charlotte Observer's editorial board wrote on Thursday.

"The new bill ensures that all gay people — not just transgender people seeking to relieve themselves without being harassed — are susceptible to unequal treatment for at least the next 3 1/2 years."