Republican Governor Pat McCrory on Thursday vetoed a bill approved by North Carolina lawmakers that would allow some court officials to opt out of duties related to marrying gay and lesbian couples.

The bill, SB2, would allow magistrates and some register of deeds workers to avoid duties for all marriages based on a “sincerely held religious objection.”

In a statement, McCrory said that “for many North Carolinians, including myself, opinions on same-sex marriage come from sincerely held religious beliefs that marriage is between a man and a woman.”

He added, “we are a nation and a state of laws.”

“No public officials who voluntarily swears to support and defend the Constitution and to discharge all duties of their office should be exempt from upholding that oath,” he said.

Gay couples began marrying in North Carolina in October after the state's ban on gay marriage was struck down by a federal court.

The measure's chief sponsor, Senate leader Phil Berger, a Republican, vowed to introduce the legislation shortly after a magistrate in his district decided to resign after 12 years rather than marry gay couples.

Berger organized a rally for John Kallam Jr. outside the Rockingham County Courthouse.

“[F]orcing Magistrate Kallam to give up his religious liberties to save his job is just wrong,” Berger said at the time.

Luke Largess, lead counsel in the lawsuit that helped strike down North Carolina's ban, criticized final passage of the bill in the House.

“It is shameful that this bill has passed our legislature,” he said in a statement provided by The Campaign for Southern Equality. “It is nothing more than state sanctioned discrimination and a naked attempt to make a political statement without much care for how it hurts and demeans others. To be certain, if this bill becomes law, it will invite a new round of court challenges.”

Berger has denied that his bill is discriminatory.

“Read it. Show me the discriminatory language and I'll say, 'Hey, that's discriminatory language.' It's not in the bill. It's in their imagination,” Berger told ABC 11.

Lawmakers have not said whether they will attempt to override McCrory's veto.