I don't know how their constitution works but America has an amendment clause which basically States all laws must have a secular purpose. Meaning you don't get to pass laws that favor anyone religion or laws that are against anyone religion
There's really not much reason to make same-sex marriage illegal other than religious reasons which is irrelevant when it comes to legislation
Technically that's a read-into of the 1st's order to CONGRESS.
By the Original readings of the Constitution, it was quite acceptable for States to have a Religion. Numerous States had State churches when the Constitution was signed. That means that for nearly 20 years, the US States were, independent of the Church of England, carrying a State Religion, though the practice did quickly get removed from most of the Constitutions after the US Constitution was completed. Numerous State and Federal Courts recognized the US as a Christian nation, routinely using the name of Christian to describe our laws and origin. Even Thomas Jefferson attended church in the US Capital Building, despite being one of two, possibly three actual atheists of the 130something signing Founders (many of whom are now ignored by media because they routinely couched the US in Christain terms, Including General George Washington, and President George Washington).
For instance, why use a Christian Bible for 250 years to swear oath?
Religion is a Right of 'The People'. The People never gave 'The Federal' Authority to discuss Religion, in the Document We The People gave each other, called Constitution. So 'The States' may well still be made into Religious Entities, by The People, if The People so decide. And The Federal technically has no authority to say otherwise. This would be clear from the 9th and 10th amendments, and the same sentiment of seperation of Rights of People and States is in the original text of the Constitution as well, I just forget if it's Article 4 or elsewhere right now.
The Federal is limted by The Constitution, if it's not in there, the Constitution tells The Federal (and reminds us) that it's Ours or The States'.