North Carolina Gov. Pat McCrory speaks to supporters at an election rally in Raleigh, N.C., Wednesday, Nov. 9, 2016. AP Images/Chuck Burton RALEIGH, N.C. (AP) — North Carolina leaders struck a deal Monday to kill the state law widely derided as the "bathroom bill," after it tarnished the state's reputation, cost it scores of jobs and contributed to the Republican governor's narrow loss.

Outgoing Gov. Pat McCrory announced he would call legislators back to the Capitol on Wednesday to repeal the law known as HB2, which excludes sexual orientation and gender identity from antidiscrimination protections. The law also requires transgender people to use restrooms corresponding with the sex on their birth certificate in many public buildings.

Undoing the law would be a step toward mending political divisions that remain raw well after Election Day. Just last week, lawmakers called a special session to strip Democratic Gov.-elect Cooper of some authority before he takes office next month.

The state's Republican leaders confirmed they're open to repealing HB2, but in a sign of lingering acrimony, they accused Cooper of taking too much credit for winning their cooperation.

The passage of HB2 in March thrust North Carolina into a national debate on transgender rights and harmed the state economically. The state missed out on new jobs as companies declined to expand in the state, while cancellations of concerts and conventions exacted a toll. The NBA moved its All-Star game to New Orleans, and in a huge symbolic blow to the college basketball-crazy state, the NCAA and ACC relocated events.

Monday's surprising events began in the morning when the Charlotte City Council voted to undo a local nondiscrimination law enacted in early 2016. That ordinance, Republicans legislators say, challenged social norms and spurred them to pass HB2.

"Senate Leader Phil Berger and House Speaker Tim Moore assured me that as a result of Charlotte's vote, a special session will be called ... to repeal HB2 in full," Cooper said in a statement Monday morning. He initially said the session would be Tuesday.

McCrory said Democrats used the issue for political gain.

"This sudden reversal with little notice after the gubernatorial election sadly proves this entire issue, originated by the political left, was all about politics and winning the governor's race at the expense of Charlotte and the entire state of North Carolina," said McCrory, a former Charlotte mayor.

Berger and Moore issued a joint statement saying they would take up the repeal if McCrory calls them into session. They said the debate over transgender bathroom access started with Charlotte and was pushed by Cooper as "a political stunt to drive out-of-state money into the governor's race."

Republicans have defended the bathroom provisions as providing privacy and safety by keeping men out of women's restrooms. Opponents call it discriminatory.

The law was also seen as a referendum on McCrory, who became its national face. He lost by about 10,000 votes while fellow Republicans U.S. Sen. Richard Burr and President-elect Donald Trump comfortably won the state. McCrory was the first sitting North Carolina governor elected to a four-year term to lose re-election.

Charlotte City Council member Julie Eiselt said she spoke to Cooper late Sunday night about the city repealing the ordinance to pave the way for getting rid of HB2.

"We needed to know that the governor-elect had confidence that there would be a special session arranged to take a vote on this," Eiselt said.

The council's move is contingent on North Carolina fully repealing HB2 by Dec. 31.

Republicans have said the Charlotte ordinance — which ensured transgender people the right to use restrooms corresponding to their gender identity — had to go first before they would consider getting rid of HB2.

A repeal of the state law could also end protracted legal challenges by the federal Justice Department and transgender residents. Much of that litigation has been delayed while the U.S. Supreme Court hears a separate Virginia case on transgender restroom access.

LGBT advocates were cautiously optimistic that the General Assembly would follow through with any repeal, but they also said antidiscrimination protection is an issue more important than politics.

"LGBT rights aren't a bargaining chip. Charlotte shouldn't have had to repeal its ordinance in exchange for HB2 to be repealed," Simone Bell, the Southern Regional Director for Lambda Legal, said in a statement. "LGBT people in North Carolina still need protection from discrimination."

___

Associated Press writer Tom Foreman Jr. in Charlotte contributed to this report.