WINSTON-SALEM, N.C. (Reuters) - A U.S. judge weighing whether to halt a North Carolina law that restricts bathroom access for transgender people in government buildings and public schools questioned at a hearing on Monday what problem the measure fixed and how it would make restrooms safer.

Republican lawmakers cited privacy and security concerns when North Carolina in March became the first U.S. state to require transgender people to use single-sex government-owned public restrooms and changing facilities that correspond to the gender on their birth certificate.

During a hearing in which he heard arguments over whether to grant a court order to block the law while litigation over its legality continues, U.S. District Court Judge Thomas Schroeder, an appointee of Republican former President George W. Bush, sounded skeptical about the law’s intent and logistics.

“We’re going to have people dressed like men who consider themselves men walking into a women’s restroom,” the judge said during a 3 1/2-hour hearing in Winston-Salem. “How is that going to work?”

Transgender rights have become an increasingly divisive issue in the United States, and the use of public bathrooms has been a flashpoint in the controversy. The North Carolina law, which also blocked local measures protecting lesbian, gay, bisexual and transgender people from discrimination, made the state a target of boycotts by companies, musicians and the National Basketball Association, which pulled its 2017 All-Star Game from Charlotte.

Opponents of the measure, including the U.S. Justice Department and the American Civil Liberties Union, asked Schroeder to block the bathroom provisions while their legal challenges proceed.

The judge did not immediately rule. A trial is set to begin on Nov. 14.

Critics of the law said it is stigmatizing, insulting and unconstitutional. They argued the state had no record of privacy complaints or security concerns related to transgender people that would warrant such a measure.

“I don’t think we can view this law as anything other than an attack on this community,” said Paul Smith, a lawyer who argued for the challengers.

Butch Bowers, a lawyer for Republican Governor Pat McCrory, said the state acted to reaffirm its stance on privacy expectations after Charlotte, the state’s largest city, adopted an anti-discrimination ordinance allowing transgender people to use bathrooms that correspond to their gender identity.

The state law blocks such access in government-owned bathrooms but permits private businesses to set their own policies.

Bowers said some people likely will continue using public facilities consistent with their gender identity despite the law. The law includes no mechanism to enforce violations, Bowers added.

“Then why have it?” Schroeder asked. “I don’t understand.”

The Obama administration in May sued North Carolina in federal court, asserting that the measure violated the 1964 Civil Rights Act.