Sanctioned discrimination

A thought that’s been rattling around in my head lately.
It seems to me that pretty much anybody who objects to gay people and gay marriage does so on the basis of religion. Whether the claim is that it erodes the institution of marriage, or that it’s immoral, or whatever the objection, there’s almost always some religious doctrine that it’s based on.
So where do all these laws against gay marriage fit in when you consider the principle of separation of church and state as written in the First Amendment?