RALEIGH, N.C. (AP) — Roughly 5 percent of North Carolina’s magistrates are refusing to marry same-sex couples for religious reasons, and lawyers for the state say people suing in federal court have no standing to challenge these opt-outs as unconstitutional.

U.S. District Judge Max Cogburn scheduled a hearing for Monday in Asheville in part to consider a motion by the state to dismiss their lawsuit altogether. Separately, Republican legislative leaders and some magistrates also want to be added as defendants as the case, saying they don’t trust Democratic Attorney General Roy Cooper to defend the state law.

Three couples — two lesbian and one heterosexual — say taxpayer dollars are being spent to implement the 2015 opt-out law that treats them as second-class citizens and favors one set of religious views over another.

“It allows judicial officers to opt out of upholding the constitution,” said Jake Sussman, one of their attorneys. “We don’t believe that the law appropriately balanced issues of religious liberty and these constitutional obligations.”

Now that Mississippi’s broad religious-objection law is blocked in court, North Carolina and Utah are the only states enabling government officials to recuse themselves for religious reasons, according to the National Conference of State Legislatures.

If the law is struck down, religious freedom would be harmed not only in North Carolina but nationwide, particularly after the U.S. Supreme Court legalized gay marriage nationally, another attorney says.

“What the United States Supreme Court did last year was a sea change,” and the government officials affected have a right to be protected, said Mat Staver, founder of the Florida-based Liberty Counsel. The legal aid group is representing Alexander County Magistrate Brenda Bumgarner, who wants to enter the lawsuit.

Bumgarner is among the 31 of the state’s 670 magistrates who now have invoked the law. It exempts magistrates and certain workers in Register of Deeds offices from all marriage transactions — gay and heterosexual — for at least six months if they fill out a religious objection form. In North Carolina, Registers of Deeds offices issues marriage licenses while magistrates can officiate over a civil marriage.

State lawmakers approved this opt-out procedure in June 2015 after several magistrates resigned, feeling the state court system would punish or fire them if they didn’t officiate at gay marriages. While the magistrates took oaths to defend the constitution and carry out laws, supporters of the law say they shouldn’t have to scrap their strongly-held religious views at the same time.

The law provides for a chief District Court judge or county Register of Deeds — both elected officials —to carry out marriage transactions if no one else is available. Additional workers also can be brought in adjoining areas to fill in.

That’s what’s happened in McDowell County, just east of Asheville, where all magistrates opted out, according to the lawsuit. One of the lesbian couples who sued lives in McDowell County but is already married.

The lawsuit doesn’t allege any delays or denials of marriage licenses due to the opt-out law, but says the second lesbian couple who sued is engaged and wishes for a magistrate to officiate in their marriage “untainted by the stigma of animus” arising from the recusals.

House Speaker Tim Moore, Senate leader Phil Berger, Bumgarner and other named magistrates argue that Cooper’s public opposition to the law makes him a poor advocate to defend it. A federal magistrate judge disagreed in July, saying Cooper’s office was mounting a vigorous case. Cooper is running this fall against Republican Gov. Pat McCrory, who vetoed the law but was overridden by the GOP-led legislature.

Cogburn, an appointee of President Barack Obama, was the first judge to formally strike down North Carolina’s gay marriage ban in October 2014.