The National Basketball Association on Thursday dealt a blow to the economy and prestige of North Carolina by pulling next February’s All-Star Game from Charlotte to protest a state law that eliminated anti-discrimination protections for lesbian, gay, bisexual and transgender people.

The move was among the most prominent consequences since the law, which also bars transgender people from using bathrooms in public buildings that do not correspond with their birth gender, was passed in March.

The league, which has become increasingly involved in social issues, said that both it and the Hornets, the N.B.A. team based in Charlotte, had been talking to state officials about changing the law but that time had run out because of the long lead time needed to stage the game. The N.B.A. said it hoped the game could be played in Charlotte in 2019, with the clear implication that the law would have to be changed before then.

“While we recognize that the N.B.A. cannot choose the law in every city, state and country in which we do business, we do not believe we can successfully host our All-Star festivities in Charlotte in the climate created by the current law,” a statement by the league said.