RALEIGH, N.C. — Two North Carolina lawmakers and a magistrate have asked a federal court to let them defend a religious exemption law involving civil marriages challenged as discriminatory against gays.

They largely blame their request on Attorney General Roy Cooper, who is personally opposed to the law but whose office represents the state in the litigation.

Senate leader Phil Berger, House Speaker Tim Moore and Alexander County Magistrate Brenda Bumgarner filed motions this week to intervene in the lawsuit as additional defendants, represented by private attorneys. They contend that Cooper cannot adequately defend a law that he is known to personally oppose.

Three couples sued in December over the law the General Assembly passed last year that allows local magistrates, who can preside over marriages, to opt out of performing all marriages if they have a “sincerely held religious objection.” The law and litigation also covers assistant and deputy registers of deeds who issue marriage licenses.

Department of Justice spokeswoman Noelle Talley said the agency, which Cooper heads, has effectively defended several laws that the attorney general himself opposes personally.

“It’s a waste of taxpayer dollars for legislators to pay outside lawyers to do the work our attorneys are already doing defending the state in this case,” Talley wrote Friday by email. State attorneys filed their own motion late Friday asking the lawsuit be dismissed.

The request marks the latest incidence in which the Republican-led General Assembly has hired private attorneys to defend legislation, spending several million dollars. In some cases, GOP lawmakers have said they’re concerned Cooper won’t defend laws robustly because of his negative comments about them. The legal fighting has been magnified because Cooper, a Democrat, is running for governor.