Over the past two decades, and particularly in the last three years, we’ve seen a sea change in public opinion. In the mid-’90s, almost 70 percent of Americans opposed same-sex marriage. Now, according to a Gallup poll published last week, half of Americans believe that same-sex marriages should be legally recognized as valid, with the same rights as traditional marriages. The Pew Research Center reports slightly lower numbers, but also shows more Americans supporting same-sex marriage than opposing it.

The country’s division over same-sex marriage is narrow enough for opponents to throw serious obstacles in its path. But it’s only a matter of time until they’re swamped by a demographic tide, because opposition to same-sex marriage is heavily concentrated in the oldest segments of the population. Less than one third of Americans aged 70 to 79 support same-sex marriage, whereas 56 percent of those aged 30 to 39 and more than 70 percent of those aged 18 to 29 are in favor of it.

And the growing visibility of gays and lesbians—in the military, in business, on television, and in people’s own kin networks—is eroding opposition even among the older generation. A 70-year-old Romney supporter told a New York Times reporter the day after Obama’s announcement: “I can’t say if I’m for it or against it, because I don’t know what my grandkids will be.”

These changes in sentiment are not just about “tolerance.” They reflect a historic transformation in what heterosexuals expect from their own marriages.

For millennia, marriage was about property and power rather than mutual attraction. It was a way of forging political alliances, sealing business deals, and expanding the family labor force. For many people, marriage was an unavoidable duty. For others, it was a privilege, not a right. Servants, slaves, and paupers were often forbidden to wed, and even among the rich, families sometimes sent a younger child to a nunnery or monastery rather than allow them to marry and break up the family’s landholding.

The redefinition of traditional marriage began about 250 years ago, when Westerners began to allow young people to choose their partners on the basis of love rather than having their marriages arranged to suit the interests of their parents. Then, just 100 years ago, courts and public opinion began to extend that right even to marriages that parents and society disapproved.

In the 1940s and 1950s, many states repealed laws that prevented particular classes of people—including those with tuberculosis and “the feeble-minded”—from marrying. In 1967 the U.S. Supreme Court ruled it unconstitutional for states to prohibit interracial marriage. In 1987 it upheld the right of prison inmates to marry.

The path to same-sex marriage was further opened up when heterosexual couples began to push back against state control over their sexual and reproductive lives. Until the 1950s, some states forbade married couples from using assisted reproduction to have children, ruling that artificial insemination was tantamount to adultery and any resultant child was illegitimate. Conversely, until the Supreme Court ruled in 1965 that couples had a right to sexual privacy, many states refused to allow the sale of birth control to married couples who wanted to prevent or limit their childbearing.

Marriage itself has evolved in ways that make it harder to justify excluding same-sex couples from its benefits and obligations.

The longstanding idea that the validity of a marriage depended on the ability and willingness of a couple to have children was eroded on two fronts when married couples who were not biologically capable of having children won access to other ways of starting a family—through artificial insemination, sperm donors, surrogate mothers, and liberalized adoption laws—and married couples who did not want children won the right to use contraception. Increasingly, Americans came to agree that two people who loved each other should be allowed to marry and to make their own decisions about whether or how to bring kids into the world.

But the most important cultural change that has increased support for same-sex marriage is the equality revolution within heterosexual marriage.

For most of history, the subordination of wives to husbands was enforced by law and custom. As late as the 1960s, American legal codes assigned differing marital rights and obligations by gender. The husband was legally responsible for supporting the family financially, but he also got to decide what constituted an adequate level of support, how to dispose of family property, and where the family would live. The wife was legally responsible for providing services in and around the home, but she had no comparable rights to such services.

That is why a husband could sue for loss of consortium if his spouse was killed or incapacitated, but a wife in the same situation could not. And because sex was one of the services expected of a wife, she could not charge her husband with rape.

Between the 1970s and 1990s, however, most Americans came to view marriage as a relationship between two individuals who were free to organize their partnership on the basis of personal inclination rather than preassigned gender roles. Legal codes were rewritten to be gender neutral, and men’s and women’s activities both at home and work began to converge.

Today, the majority of American children grow up in homes where their parents share breadwinning, housework, and child care. Some couples even decide to reverse traditional gender roles, with the woman becoming the primary breadwinner or the man becoming a stay-at-home dad.

The collapse of rigid gender expectations and norms has fostered the expectation that marriage should be an individually negotiated relationship between equals, replacing the older notion of marriage as a prefabricated institution where traditional roles and rules must be obeyed.

The result is a paradox. Marriage is now more optional than in the past, and people are far less willing to remain in a marriage that doesn’t feel fair, loving, and mutually respectful. On the other hand, as a result of these changes, many marriages have become more fulfilling and mutually beneficial than ever before.

Domestic violence rates have plummeted over the past 30 years, dropping by 50 percent since 1980. The divorce rate, which rose sharply in the 1960s and 1970s, has been falling since its peak in 1981, and it has fallen the most for educated couples, who are the most likely to mix and match traditional gender behaviors.

The growing acceptance of same-sex marriage is the result of these profound changes in heterosexual marriage. It’s not just the president’s views on marriage that have evolved. Marriage itself has evolved in ways that make it harder to justify excluding same-sex couples from its benefits and obligations.

A rearguard action by a determined minority may hold back the tide of history for a while. That is why many opponents are eager to pass one-man/one-woman amendments that will take a two-thirds majority to overturn. But same-sex unions are here to stay. The question is whether our political and legal system will recognize that reality now—or whether gays and lesbians will have to wait until the out-of-touch opposition to marriage equality literally dies off.