The deal must still pass the state Congress and its terms have angered LGBT activists.
A late-night deal has been reached in North Carolina to repeal a controversial law that limits protections for lesbian, gay, bisexual and transgender (LGBT) people.
A key element banned transgender people from using restrooms in accordance with their chosen gender, earning the measure the «bathroom law» tag.
The deal came hours before the state was to lose key basketball fixtures.
However, the terms of the deal have angered LGBT activists.
It must also still pass both the state House and Senate in votes on Thursday morning and it remains unclear whether it has enough support.
The deal was announced late on Wednesday by Democratic Governor Roy Cooper and Republican state lawmakers.
Mr Cooper, who ran for office on a platform of repealing the measure, known as House Bill 2, said: «It’s not a perfect deal, but it repeals HB2 and begins to repair our reputation. »
Majority Republican leaders Tim Moore and Phil Berger said in a joint statement: «Compromise requires give and take from all sides, and we are pleased this proposal fully protects bathroom safety and privacy. »
The law had required transgender people to use toilets in schools and government buildings that correspond to the sex listed on their birth certificates.
Although the deal repeals the law, state legislators will remain in charge of policy on multi-occupancy restrooms.
It creates a moratorium so that local government, state colleges and universities cannot pass measures extending non-discrimination on sexual orientation and gender identity until December 2020.
The compromise angered LGBT activists.
Equality NC executive director Chris Sgro said before the proposal was agreed that it was «a train wreck that would double down on anti-LGBTQ discrimination. North Carolinians want a clean repeal of HB2, and we urge our allies not to sell us out».
Human Rights Campaign president Chad Griffin said: «At its core, it’s a state-wide prohibition on equality. »
Businesses, entertainers and sports teams had boycotted North Carolina in the wake of the law’s passage last year.
Its largest city, Charlotte, lost the National Basketball Association (NBA) All-Star game, which was moved to another state.
North Carolina was on Thursday set to lose its ability to host any college (NCAA) basketball championships.
Mr Cooper beat Republican Pat McCrory, who had signed the law, in an election in December.