North Carolina's law limiting protections for LGBT people took center stage Friday in the state's first gubernatorial debate between the incumbent who signed the law and his challenger who wants to repeal it.

Republican Gov. Pat McCrory and Democratic challenger Roy Cooper made clear their differences to a Charlotte audience over the law, known as House Bill 2.

Cooper, the state's attorney general, has refused to defend the law in court.

The law requires transgender people to use bathrooms in schools and government buildings that conform to the sex on their birth certificate. It's been condemned by gay-rights groups, corporate executives and entertainers from Bruce Springsteen to Pearl Jam. Social conservatives and GOP allies in the legislature, however, have praised the law.

The North Carolina law has become part of larger debate about transgender rights. In May, the Obama administration issued a directive stating public schools must permit transgender students to use bathrooms and locker rooms consistent with their chosen gender identity.

The candidates staked opposing positions on the law in a gubernatorial campaign expected to be among the most expensive in the nation. Democrats in Washington see North Carolina as the best chance to flip a governor's mansion their way in November.

Cooper said McCrory's defense of the law — the governor has sued the federal government to uphold the bathroom provisions — has stopped companies from relocating or investing in North Carolina and placed the state in a negative light nationally.

"The governor continues to hurt our economy by his doubling and tripling down on House Bill 2," Cooper said North Carolina Bar Association annual meeting in Charlotte. "He has made sure that we've lost hundreds of millions of dollars and thousands of jobs. That's wrong for this state."

McCrory says the economy is strong and downplays the law's economic effects. A former Charlotte mayor first elected in 2012, McCrory frames the law as stopping government overreach and protecting the privacy of children and adults using restrooms and locker rooms.

Republican legislators and ultimately the government sought the changes after Charlotte city leaders in February approved an ordinance expanding discrimination protections to LGBT people at the city's hotels, restaurants, retail stores and other public accommodations.

House Bill 2 overturned Charlotte's ordinance and prevents local or state governments from passing similar rules. But it also directs transgender people to use bathrooms in the government buildings aligned with their biological sex.

"A boy who is a boy who thinks he's a girl should not go into the girls shower," McCrory said. "Roy Cooper believes a boy who thinks he's a girl and still has the anatomy of a boy can go into a girls shower in our middle schools and in our high schools and our universities. I strongly disagree with those values and the courts are going to now decide."

Cooper believes the directive wouldn't change day-to-day operations in public schools and said Friday that McCrory has put problems upon himself by signing the law.

"He's blamed the left wing, Charlotte, Charlotte schools, the media, President Obama, all of the musicians," he said. "I think the governor needs to take a long look in the mirror here."

The two candidates also prodded each other Friday on the economy, teacher pay and tax policy. McCrory positioned himself as an outsider who came to Raleigh to clean up what Democrats like Cooper who had controlled state government for decades had produced.

McCrory highlighted bills he signed that lowered income tax rates and accelerated the repayment of more than $2.5 billion owed the federal government to cover unemployment benefits. The state's jobless rate is now at 5 percent, half of what it was when he took office. Cooper, a former legislator elected attorney general in 2001, said tax changes haven't helped the middle class and school teacher morale is low because average pay remains near the bottom of the states.