Marriage is simply a contract, recognized by the State, which defines how the parties to the contract will share property, financial and personal obligations, and so forth. In exchange, they are given certain legal rights (e.g. inheritance, power of attorney, visitation in hospitals, and so forth). It's a civil contract, which means it is a civil right.
This is not to be confused with a religious ceremony recognized by your church -- e.g. a Wedding, "holy matrimony" -- which generally has no legal validity with the state.
You can be married (Justice of the Peace) without a church wedding. As long as you registered a Marriage License, the state will recognize your marriage, but your church might not. The state is free to say who can be married -- but it is not free to dictate the beliefs of your church (or anyone else's), including who is allowed to have a wedding ceremony in your church.
And you can have a wedding at your church without bothering to register the marriage with the state. (It's called a Marriage License, not a Wedding License.) Your church will recognize your marriage, but the state might not. Your church is free to say who can have a wedding in your church -- but it is not free to dictate who the state will allow to be married, or to tell other churches to recognize the marriage.
They're entirely separate things.