Last night's vote to allow same-sex marriage was an unequivocally good thing. The classical liberal principle of equality before the law demands that the state treats gay couples the same way it treats straight ones. Giving gay couples the same recognition as straight couples will be good for them, their children, and society at large.

But there is a bigger question that has largely been ignored – whether the government should be involved in marriage at all. The debate over gay marriage has, fortunately, been won by the right side, but why is it any business of parliament who we may and may not marry at all?

Historically, marriage as a state-defined institution is a relatively new phenomenon. It was only in 1837 that the state began to register marriages, and less than 100 years before that that it made legislation concerning marriage at all. Before then, marriage was a contractual arrangement agreed upon by two individuals, upheld in the common law.

Nearly all of what makes up a modern marriage could be agreed on privately in a contract between two (or, indeed, more) consenting adults. Next of kin nomination, the sharing of property rights, duties of care, parental rights and other things that marriage affects could all be agreed upon voluntarily – there is no need for the state to regulate these agreements outside the general rules of contract law. The process of dissolution of a marriage would be agreed upon in advance. For example, a couple could agree on an arbitrator in advance to carry out a divorce, if it came to that. People would be able to sign their marriage contracts wherever they wanted – in a church, a function hall, a forest or a kitchen – with whatever kind of ceremony they wanted. As private institutions, individual churches would be free to take part in or opt out of any ceremonies they wanted to.

Extending state privilege to same-sex couples is a good thing, but fundamentally the government should not give special rights to married couples at all. It should de-couple things like inheritance tax exemptions and parental access from marriage.

Though it would allow for an unprecedented amount of freedom in the types of marriages people took part in, most couples would probably not want a special arrangement. It is easy to imagine law firms or even high-street shops offering popular "standard marriage" contracts, based on conditions that seem to have worked. That would allow most people to have "normal" marriages, while still allowing for more unconventional arrangements for those who wanted them.

Most importantly, this would take marriage out of the hands of the majority. As the marriage "traditionalists" (who are arguably misnamed, given mankind's long history of polygamy and same-sex coupling) have learned, dependence on the state to enforce the values you hold is a dangerous game. Most MPs have now accepted the value of gay relationships, but that might change. The best way to safeguard against state bigotry is to take power over marriage out of the hands of the state altogether.

Tradition is valuable, but only when it stands on its own without state support. As FA Hayek argued, social progress comes from people experimenting in how they live. The best system is the one that allows for that experimentation and accommodates diverse approaches to life. Getting the government out of the marriage business is one good way to foster diversity, give people control over their lives and end marriage inequality.