The North Carolina senate on Wednesday voted down a proposal to repeal the state's controversial law restricting transgender restroom access.

The legislation to repeal the law, known as House Bill 2 (HB2), was defeated by a vote of 32-16, leaving the bathroom restrictions in place statewide.

The Republican-dominated state senate then adjourned without voting on a second, related provision that would have temporarily banned cities from affirming transgender bathroom rights.

The state's house of representatives, also controlled by Republicans, voted earlier in the day to adjourn.

Legislators had called a special session to consider scrapping the law, which passed in March and made North Carolina the first state to bar transgender people from using public restrooms that match their gender identity rather than the gender on their birth certificate.

Supporters of the law cited traditional values and a need for public safety while opponents called it mean-spirited and unnecessary.

North Carolina's Republican-dominated state senate voted down HB2 by a vote of 32-16 on Wednesday. (Jonathan Drake/Reuters)

HB2 faced pushback across U.S.

The national backlash was swift and fierce, leading to boycotts that have been blamed for millions of dollars in economic losses for the state, as events such as the National Basketball Association's 2017 All-Star Game were moved out of North Carolina.

The pushback was widely cited as the reason Republican Gov. Pat McCrory lost his re-election bid in November to Democrat Roy Cooper, who called for the repeal of the law. Cooper had said he reached a deal with state Republicans to repeal the law.

But Republicans eventually proposed pairing the repeal with a months-long "cooling-off period," or moratorium, in which local jurisdictions would be banned from enacting their own ordinances regulating public bathrooms, showers or changing facilities.

Opponents of North Carolina's HB2 law protest in the gallery above the state's house of representatives chamber in Raleigh, N.C., on Wednesday. (Jonathan Drake/Reuters)

The moratorium died without the senate taking any action. HB2 was enacted largely in response to a local measure in Charlotte that protected the rights of transgender people to use public bathrooms of their choice. The Charlotte city council on Monday repealed its ordinance as a prelude to the state repealing HB2.