North Carolina's largest city passed a law Monday allowing transgender people to choose public bathrooms that correspond to their gender identity, which the governor had called a threat to public safety and warned that the General Assembly may step in.

The Charlotte City Council voted 7-4 to expand protections based on sexual orientation and gender identity, making it the latest frontier in a national debate on how businesses treat gay, lesbian and transgender customers. One of the revisions to the city's nondiscrimination ordinance allows people to choose restrooms corresponding to the gender with which they identify.

North Carolina Gov. Pat McCrory — a former mayor of Charlotte, one of the 20 largest cities in the U.S. according to census figures — said in an email Sunday that changing the policy on restrooms could "create major public safety issues."

"Also, this action of allowing a person with male anatomy, for example, to use a female restroom or locker room will most likely cause immediate State legislative intervention which I would support as governor," he wrote in the email to two Council members.

The issue has been part of a national debate that included the high-profile defeat of a similar ordinance late last year by voters in Houston, and LGBT advocates worried bathroom-access fears would be used elsewhere to fight equal-rights measures. South Dakota legislators recently passed a bill requiring students to use bathrooms corresponding to their sex at birth, though it hasn't been signed by the governor.

In North Carolina, the advocacy group Equality NC issued a statement criticizing McCrory for "perpetuating the same tired and debunked myths about transgender people and public safety." Executive director Chris Sgro accused the governor and legislators of trying "to bully the Charlotte City Council with threats to strip municipalities of their rights to govern."

During the meeting, about 140 members of the public got one minute each to give the council their opinions on the measure. Because the council chambers were filled to capacity, some speakers had to stay in an adjacent room and await their time.

Materials given to the council ahead of the meeting cited some residents' concerns that sexual predators would use the ordinance to gain entry to women's restrooms for assault or indecent exposure, but it also noted that staff researchers hadn't uncovered any evidence of an increase in such crimes in cities with non-discrimination ordinances.

Before the meeting, several hundred people stood outside in a wind-driven rain to protest the proposal, holding signs with messages such as: "No Men In Women's Restrooms" and "Keep Kids Safe."

Chris Williams, a 30-year-old father of three, passed out "No" stickers to the crowd, saying most Charlotte residents "stand with religious values."

"I don't want my kids having to even question, 'Why is there this person in the restroom?'" he said. "I don't think they should even be faced with that question and that concern."

The measure adds sexual orientation, gender identity and marital status as attributes protected from discrimination when it comes to public accommodations including restaurants, retail stores and other businesses. It would take effect in April. Public school would not be affected by the law.

A similar measure was narrowly defeated by the Charlotte City Council in March 2015, even after the removal of a provision that would have allowed bathroom use based on gender identity. Local officials later announced that transgender people could use the bathrooms corresponding to their gender identity in city- and county-owned facilities.

Members of Charlotte's LGBT community said in a survey the changes are needed because they have been denied service, received poor service or experienced disparaging comments, according to supplemental materials attached to Monday's Council agenda.

Opponents of the measure — including some clergy and business owners — have sent the City Council a letter saying businesses should have the right to refuse service based on sexual orientation or gender identity.