RALEIGH, N.C. — The dueling lawsuits over North Carolina’s law on bathroom use by transgender people have landed in the hands of three federal judges appointed by Republican presidents, with both sides trying to maneuver into the most favorable courtroom possible.

Legal experts expect some or all of the five cases to be combined. But it remains to be seen whether they will be decided in the court picked by the law’s opponents for its moderate reputation, or in the more conservative court chosen by the measure’s GOP supporters.

“This is definitely a strategic decision by the plaintiffs to file in the district they like best,” said Tom Metzloff, a Duke University law professor and expert on civil procedure.

Either way, the dispute could ultimately be headed for the US Supreme Court for a ruling once and for all on whether federal laws including the Civil Rights Act of 1964 protect transgender people from discrimination.

At issue is a state law that says transgender people must use public bathrooms, showers and changing rooms that correspond to the sex on their birth certificate. Supporters say the law is needed to safeguard people’s privacy and protect women and children from molesters. Opponents, including the Obama administration, say the danger is imaginary and the law discriminatory.

With economic pressure on the state mounting, the US Justice Department and North Carolina’s governor sued each other over the measure Monday. Lawsuits for and against the law have also been filed by the American Civil Liberties Union, leaders of the Republican-controlled state Legislature, and a conservative legal organization.

As for possible clues to how the judges might rule, one of them has already decided in favor of a transgender plaintiff in a separate case. Another sided with state GOP leaders in a high-profile case on voter ID laws, while the third riled environmentalists with a ruling on a bridge project in the ecologically fragile Outer Banks.

Still, whatever the judges’ backgrounds, opponents have a strong hand because of a recent federal appeals court ruling in favor of a transgender teen who was seeking to use the boys’ bathroom at his Virginia high school. The ruling by the 4th US Circuit Court of Appeals, which oversees North Carolina, interpreted the federal discrimination law Title IX in a way that directly affects a key aspect of the North Carolina case.

“It’s going to be hard for the judge not to follow the 4th Circuit precedent. And if he does that, the language of Title VII — the ’64 Civil Rights Act — is basically the same as the Title IX language. It prohibits discrimination on the basis of sex,” said William Yeomans, a legal scholar who spent 26 years at the Justice Department during Democratic and Republican administrations.

The five cases are split between two districts — one in the eastern part of the state that is considered more conservative, the other in the middle section.

Legal scholars agree that opponents of the law chose the middle district because of the more moderate overall reputation of its six judges. That strategy only goes so far, however, because cases are initially assigned at random, Metzloff said.

The two cases challenging the North Carolina law — one filed by the ACLU, the other by the Justice Department — wound up before US District Judge Thomas Schroeder.

In April, Schroeder rejected arguments by the Justice Department and the NAACP in a ruling upholding a voter ID law passed by the Legislature. He wrote that “some segment of the state’s African-Americans endure socioeconomic disparities that can be linked to state discrimination,” but the plaintiffs “failed to show that such disparities will have materially adverse effects on the ability of minority voters to cast a ballot.”

He was nominated to the federal bench in 2007 by President George W. Bush.

While perceived as more moderate than some of his colleagues, “he is certainly not known for being liberal,” said Maxine Eichner, a law professor at the University of North Carolina.

To the east, the case filed by the governor in defense of the law wound up before US District Judge Terrence Boyle, a former aide to archconservative Sen. Jesse Helms who was denied a seat on the 4th Circuit by the Democrats after a 16-year standoff. He was first appointed to the federal bench by President Ronald Reagan in 1984.

Still, observers say his conservative reputation may be overstated. In 2015, he gave a favorable ruling to a transgender job applicant who alleged gender discrimination when she applied for a job as a nurse in High Point.

“In this case, Judge Boyle doesn’t exactly decide that transgender is protected by Title VII, but he comes pretty close,” said Katharine Bartlett, a Duke University law professor and expert on gender and law.

Two other cases filed this week in support of the law are also in the eastern district, before Judge Louise Wood Flanagan, who was nominated by Bush in 2003 and served as the district’s chief judge for seven years. In 2013, she sided with the state transportation department in a lawsuit filed by environmental groups over a bridge on the Outer Banks.

While it’s difficult to predict how the North Carolina judges will unknot the tangle of cases, Bartlett said: “Because of the division now among federal courts, ultimately the Supreme Court is going to have to decide if transgender discrimination is sex discrimination. I don’t know how soon, or under which of these laws.”