In the United States, the government -- at all levels, federal, state and local -- is allowed to discriminate against or in favor of particular groups of people. The government just has to show that the discrimination serves some permitted purpose, and depending on the groups involved may have to clear a high bar of proof that the alleged purpose is the real purpose (since some groups have historically been discriminated against for bad reasons, we have higher suspicion of new discrimination against those groups).
For example, state governments can require a person to have a driver's license before driving a car. This discriminates against people who don't have a license, but the support for it is rooted in a good reason: safety. Requiring people to pass a brief examination to show their knowledge of traffic laws and possession of the basic skills of driving is quite reasonable, and so driver's licenses are a permitted form of discrimination.
Similarly, people under a certain age typically cannot enter into contracts on their own. The support for this comes from the fact that younger people are less likely to be mature and knowledgeable and understand what they're getting into, so restricting it to a particular age (typically, the age at which one graduates from the public school system) and requiring the advice and consent of someone over that age for a minor to enter a contract is reasonable, and is permitted.
Over the past few years we've seen multiple alleged justifications for banning same-sex marriage asserted in courts, and each time they've been knocked down as nonsensical or even as contradicting the other policies of the state which advanced those arguments.
For example, we've seen an argument advanced that states have an interest in ensuring the production and safe rearing of future generations, that marriage is provided for the sole purpose of advancing that interest, and so a same-sex couple (who cannot procreate) should be excluded from marriage. Except this argument falls apart if you so much as breathe lightly on it: states which make this argument do not require any sort of commitment to have children from a heterosexual couple, and in fact will grant marriage licenses to couples known to be sterile, and many of them allow same-sex couples to adopt and raise children.
The result of this process has been that there really is no alleged justification or purpose left, other than "we don't like same-sex couples, largely for religious reasons". And that's not something our country allows as a justification for a law ("we don't like that kind of people" stopped being allowed about a half-century ago).
For example, state governments can require a person to have a driver's license before driving a car. This discriminates against people who don't have a license, but the support for it is rooted in a good reason: safety. Requiring people to pass a brief examination to show their knowledge of traffic laws and possession of the basic skills of driving is quite reasonable, and so driver's licenses are a permitted form of discrimination.
Similarly, people under a certain age typically cannot enter into contracts on their own. The support for this comes from the fact that younger people are less likely to be mature and knowledgeable and understand what they're getting into, so restricting it to a particular age (typically, the age at which one graduates from the public school system) and requiring the advice and consent of someone over that age for a minor to enter a contract is reasonable, and is permitted.
Over the past few years we've seen multiple alleged justifications for banning same-sex marriage asserted in courts, and each time they've been knocked down as nonsensical or even as contradicting the other policies of the state which advanced those arguments.
For example, we've seen an argument advanced that states have an interest in ensuring the production and safe rearing of future generations, that marriage is provided for the sole purpose of advancing that interest, and so a same-sex couple (who cannot procreate) should be excluded from marriage. Except this argument falls apart if you so much as breathe lightly on it: states which make this argument do not require any sort of commitment to have children from a heterosexual couple, and in fact will grant marriage licenses to couples known to be sterile, and many of them allow same-sex couples to adopt and raise children.
The result of this process has been that there really is no alleged justification or purpose left, other than "we don't like same-sex couples, largely for religious reasons". And that's not something our country allows as a justification for a law ("we don't like that kind of people" stopped being allowed about a half-century ago).