RALEIGH, N.C. — Some North Carolina court officials could opt out of marriage duties – including same-sex marriages – under legislation approved by the state Senate.

The Senate voted 32-16 Wednesday for a bill giving magistrates and some register of deeds workers the ability to remove themselves from the process because of religious objections. The bill comes after federal judges’ in October overturned North Carolina’s same-sex marriage ban.

The measure prompted two hours of passionate words in the continuing gay marriage debate.

Supporter Buck Newton of Wilson said religious freedom is constitutionally protected and must be upheld for workers even as the state complies with court rulings.

But Sen. Josh Stein of Raleigh said government employees cannot selectively choose which members of the public they serve.

The bill now heads to the House.

© 2015, Associated Press, All Rights Reserved.

This material may not be published, broadcast, rewritten, or redistributed.