ATLANTA — In a sharp rebuff to lawmakers in his party, North Carolina’s Republican governor said on Thursday that he would veto a measure to allow certain public officials to refuse to perform marriage ceremonies on the basis of their religious beliefs.

The proposal, written by one of the General Assembly’s most influential Republicans, would allow magistrate judges “to recuse from performing all lawful marriages” if they harbored “any sincerely held religious objection.”

Although the bill does not explicitly mention same-sex marriages, critics say it is designed to block such nuptials, which began in North Carolina after rulings by federal courts. The announcement by the governor, Pat McCrory, came soon after the House of Representatives voted, 67 to 43, to support the measure, and it set into motion another significant state-level clash about religious freedom. In February, the Senate approved it, 32 to 16.

“Whether it is the president, governor, mayor, a law enforcement officer or magistrate, no public official who voluntarily swears to support and defend the Constitution and to discharge all duties of their office should be exempt from upholding that oath,” Mr. McCrory said in a statement.