Mississippi’s governor signed a law on Tuesday that allows public and private businesses to refuse service to gay couples based on the employers’ religious beliefs.

Gov. Phil Bryant signed House Bill 1523, despite opposition from gay-rights groups and some businesses who say it enables discrimination. Some conservative and religious groups support the bill.

The measure’s stated intention is to protect those who believe that marriage should be between one man and one woman, that sexual relations should only take place inside such marriages, and that male and female genders are unchangeable.

"This bill merely reinforces the rights which currently exist to the exercise of religious freedom as stated in the First Amendment to the U.S. Constitution," the Republican governor wrote in a statement posted to his Twitter account.

The measure allows churches, religious charities and privately held businesses to decline services to people whose lifestyles violate their religious beliefs. Individual government employees may also opt out, although the measure says governments must still provide services.

"This bill does not limit any constitutionally protected rights or actions of any citizen of this state under federal or state laws," Bryant said. "It does not attempt to challenge federal laws, even those which are in conflict with the Mississippi Constitution, as the Legislature recognizes the prominence of federal law in such limited circumstances."

Other states have considered similar legislation. North Carolina enacted a law, while governors in Georgia and South Dakota vetoed proposals.

Bryant acted within hours of receiving the bill after it cleared its final legislative obstacle Monday, even as opponents tried to marshal pressure to persuade Bryant to reject it.

"This bill flies in the face of the basic American principles of fairness, justice and equality and will not protect anyone’s religious liberty," Jennifer Riley-Collins, Executive Director of the American Civil Liberties Union of Mississippi, said in a statement. "Far from protecting anyone from `government discrimination’ as the bill claims, it is an attack on the citizens of our state, and it will serve as the Magnolia State’s badge of shame."

(Copyright (c) 2016 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed.)