Mayor Jennifer Roberts of Charlotte sensibly refused. Although she was under pressure from some in the business community, including the North Carolina Restaurant & Lodging Association and the Charlotte Chamber of Commerce, it would have been wrong to cave in to Mr. McCrory’s demand.

The governor and his Republican colleagues in the Legislature are solely to blame for the hundreds of jobs and millions of dollars the state has lost as businesses and sports organizations have turned away from North Carolina, because they don’t want to condone bigotry. This month, the Atlantic Coast Conference and the National Collegiate Athletic Association announced that they would move championship games in multiple sports that had been scheduled to take place in the state.

Those moves followed decisions by businesses, organizations and musicians to abort expansion plans, relocate conventions and cancel performances to protest North Carolina’s law. Those consequences have cost the state more than $200 million, according to an estimate by Facing South, an online magazine that covers policy issues in Southern states. In addition, the state itself is wasting taxpayer money defending the constitutionality of the law against lawsuits brought by the American Civil Liberties Union and the federal Department of Justice.

It’s not too late for Mr. McCrory to come to his senses and take the only way out — admit ignorance and error and repeal the law. While he and lawmakers are at it, they can acknowledge that no one has been made safer by preventing transgender people from using appropriate public restrooms, the ostensible reason for passing the law. The rule was never enforceable, since police officers can’t reasonably be required to inspect people’s genitals outside bathroom stalls. The point of the law was to harm and humiliate L.G.B.T. citizens, and for that all North Carolinians are having to pay an ever growing price.