CHARLOTTE, N.C. (AP) — North Carolina's largest city and its capital are preparing for mayoral elections; whoever is elected will most likely have to wrestle with the sensitive issue of gay and transgender rights.

Charlotte will elect Tuesday a new mayor to replace Jennifer Roberts. She lost the Democratic primary last month after becoming embroiled in a fight for LGBT rights. Two city council members, Democrat Vi Lyles and Republican Kenny Smith, are squaring off to replace her.

In Raleigh, Democratic candidate Charles Francis, who is challenging unaffiliated incumbent Nancy McFarlane, issued a statement saying he supports the gay and transgender community. The statement came days after he lost an endorsement from a key interest group questioning his credentials on gay rights.

Mayoral incumbents in Asheville, Fayetteville, Greensboro and Wilmington also are seeking re-election Tuesday, while Durham voters will pick a new mayor.

While Lyles battled with Roberts in an intense Democratic primary before winning, Smith's easy Republican primary victory helped him amass a campaign war chest that's put him on television often with advertising in the general campaign's final weeks. Smith's campaign reported having spent $538,000 as of late October, compared to $294,000 by Lyles, according to their campaign finance reports.

Smith's greatest challenge remains voter registration — Democrats outnumber Republicans in Charlotte by more than 2 to 1, although unaffiliated voters surpass Republicans and comprise 30 percent of the electorate. The Democratic National Committee announced this past week it was working with the state party to help get Lyles elected.

The specter of House Bill 2 appeared when the two candidates debated the city's key issues at WBTV in Charlotte during the campaign's final days.

HB2, passed by state legislators in response to action by the Charlotte city council and approved last year, required transgender people to use restrooms in many public buildings corresponding to the sex on their birth certificates. It also prevented local governments from expanding nondiscrimination ordinances.

A compromise replacement law approved last spring still prevents cities and counties from passing expanded LGBT protections for public accommodations and private employment until December 2020.

Specifically, Smith was asked in the debate if he would seek a change to the replacement legislation if online retailing giant Amazon wants Charlotte as its second headquarters.

"I don't see a scenario where that plays out," Smith said. "I will work with our partners in Raleigh to make sure that we stand up for Charlotte and that we have the things that are best needed for the city of Charlotte."

Lyles said she would seek the change immediately.

"If it were a deal-breaker, I would be at the General Assembly, and I would be talking about the types of jobs, what difference it would make for our economic opportunity so that we could get that 5 percent of people . . . out of poverty," Lyles said. We've got to do something."

In the Raleigh race, McFarlane led in October balloting but fell short of exceeding the 50 percent threshold needed to avoid a runoff.

Instead the three-term unaffiliated incumbent is facing a tough challenge from Francis. While McFarlane has been a favorite among liberals, the Wake County Democratic Party endorsed Francis, who has accused McFarlane of failing to address adequately affordable housing in the city of 430,000.

HB2 also became an issue when the political arm of gay rights group Equality North Carolina announced it would only endorse McFarlane in the runoff when both candidates received its backing in the October election. The head of Equality NC alleged information had surfaced that Francis was too close with local Republicans who supported HB2 or previously opposed gay rights.

The LGBT Center of Raleigh named McFarlane its LGBTQ ally of the year for 2017, noting that "we've always known that she has our back for important issues that affect our community."

Meanwhile, Francis issued a statement, reported by The News & Observer, that he opposed HB2 and that Raleigh "needs more city services targeted to the needs of trans people, LGBTQ youth, and the homeless."

In Durham, Mayor Bill Bell decided not to seek re-election after 16 years in office. Current city council member Steve Schewel and former council member Farad Ali advanced from the primary. Schewel was the top vote-getter in October. Ali received Bell's endorsement the week after the primary.

___

Associated Press writer Gary D. Robertson in Raleigh contributed to this report.