The dramatic triumph of the same-sex-marriage movement has sparked considerable interest from advocates of other causes — from climate change to immigration reform to abortion access — who would love to figure out a way to copy its special sauce.

Their interest is not all that surprising: Everybody loves a winner, and same-sex marriage won big. Few social movements have experienced such rapid success. On no other issue have public sentiment and politics been transformed so quickly and completely. By 2015, when the Supreme Court affirmed the legality of same-sex unions in Obergefell v. Hodges, a majority of the public (53 percent) favored allowing gay and lesbian couples to marry. Today, a majority of residents in only five states — Mississippi, Alabama, Arkansas, South Dakota and Tennessee — continue to oppose same-sex marriage.

But those seeking to replicate the movement’s success have their work cut out for them. The campaign to legalize same-sex marriage was helped along by a number of factors that are difficult — if not impossible — for others to copy.

More friends and family than ever are openly gay

Few things have more fundamentally altered public opinion on same-sex marriage than the increasing presence of openly gay and lesbian people in America’s social networks. In 1993, only 22 percent of Americans reported that they had a close friend or family member who was gay or lesbian. By 2009, the proportion had risen to roughly half (49 percent). Today, about two-thirds (65 percent) of Americans have a close friend or family member who identifies as gay or lesbian.

This matters because research dating to the 1950s has consistently shown that social contact with members of particular communities eases prejudice and distrust. Social contact has been shown to reduce racial animus, religious prejudice and, more recently, antipathy toward gay and lesbian people. One reason negative stereotypes and discomfort with homosexuality endured so long was that relatively few people formed close relationships with those who were openly gay.

Social contact is a particularly effective way of reducing anti-gay sentiment because gay and lesbian identity is independent of the socio-economic, ethnic, racial, religious and regional divisions that separate Americans on other issues. While coming out is more complicated in certain parts of the country and within certain communities, gay and lesbian people are members of every social class, ethnicity, religion and race. White Americans are much more likely to have a close friend or family member who is gay than black, even though black Americans vastly outnumber gays and lesbian people. (I know these groups are not mutually exclusive.) Since the early 1990s, Americans collectively met and welcomed many more gay and lesbian people into their families and social circles.

Same-sex marriage legalization was viewed as inevitable

Shortly after same-sex marriage became a national issue, most Americans thought that legalization was inevitable. In 2004, it looked like an uphill battle: Only 31 percent of the public favored legalization, and much of that support was tepid. Most Democrats wanted little to do with the issue, while Republicans were rallying against it as a cause for the 2004 presidential campaign. Yet even in such an inhospitable environment, roughly 6 in 10 Americans said legal recognition of same-sex marriage was only a matter of time.

Even Americans who were most ideologically committed to banning same-sex marriage were not terribly confident in their ability to stop it. In 2004, 47 percent of Republicans said legal recognition was a foregone conclusion, while 42 percent said it was not. By 2013, nearly three-quarters of the public (72 percent) believed it was inevitable.

As the sense of inevitability grew, it became more difficult for opponents to mount and fund their campaigns. Well before same-sex marriage was legal and at a time when public opinion was still roughly divided, the flagship organization fighting it — the National Organization for Marriage — saw its fundraising drying up; the group raised roughly 30 percent less in 2011 than it did in the previous year.

Even some political opponents of same-sex marriage signaled an early retreat on the issue. In 2013, for instance, Sen. Jeff Flake, R-Ariz., indicated he would not have a problem supporting a presidential candidate who was for same-sex marriage, saying, “I think it’s inevitable.” Few things are more demoralizing to any effort than thinking you’ve already lost.

Same-sex marriage became a touchstone issue for millennials

Yes, millennials. Numbering about 83 million, people born between the years 1980 and 2000 have expressed greater support for same-sex marriage, more vocally and consistently, than any other generation. The average family with a young adult had at least one proponent of same-sex marriage sitting around the Thanksgiving table.

Millennials also exerted considerable pressure, albeit mostly indirectly, on some of the most critical institutional opponents of same-sex marriage: places of worship. In 2013, 70 percent of millennials said religious groups were alienating young people by being too judgmental on gay and lesbian issues. A 2014 survey found that more than 1 in 3 millennials who left the church said negative treatment of gay and lesbian people was the reason. The same decade that saw same-sex marriage emerge as a major flashpoint in the culture wars, following its legalization in Massachusetts in 2003, also witnessed an unprecedented exodus from organized religion among young adults — from 18 percent identifying themselves as religiously unaffiliated in 2003 to 36 percent in 2015. In comparison, between 1974 and 2003 the proportion grew just 6 percentage points (12 percent to 18 percent).

To avoid antagonizing millennials, many religious denominations abandoned blanket denunciations of gay and lesbian people and dialed back harsh rhetoric on homosexuality; many adopted more nuanced positions. In other instances, religious leaders simply avoided the topic. A majority (55 percent) of Americans who attended religious services in 2003 heard their clergy talk about the issue of homosexuality; by 2012 only 33 percent said their clergy had recently addressed the topic.

Same-sex marriage rode a rising tide of social acceptance

The movement to legalize same-sex marriage may also have uniquely benefited from rising social acceptance of personal sexual behavior. Gallup has tracked substantial changes in the public’s attitude about divorce, premarital sex, having a child out of wedlock and same-gender sexual relations. Fewer than half of Americans (45 percent) thought it was morally acceptable to have a child out of wedlock in 2002; by 2015 the number had risen to 61 percent. Acceptance of same-gender sex increased by an even larger margin over this period. These trends are almost certainly related to the growth in the ranks of the religiously unaffiliated, who now represent nearly 1 in 4 Americans. As a group, these Americans consistently embrace much more tolerant views on a range of sexual behaviors.

SHARE WHO THINK BEHAVIOR IS MORALLY ACCEPTABLE BEHAVIOR 2001 2015 CHANGE Gay or lesbian relations 40% 63% +23 Having a baby outside of marriage* 45 61 +16 Sex between an unmarried man and woman 53 68 +15 Divorce 59 71 +12 Abortion 42 45 +3 More people are more tolerant “Having a baby outside marriage” was first measured in 2002 Data from surveys of 1,012 respondents from May 10-14, 2001 and 1,024 respondents from May 6-10, 2015 Source: Gallup

Few of the factors that helped push same-sex marriage over the finish line would seem to benefit those seeking to keep abortion legal or to prompt government action on climate change.

First, the millennial generation is not a slam dunk for those advocates. Despite being more diverse and socially liberal, millennials are not more likely than Americans overall to believe abortion should be legal or to say climate change is a priority.

Second, the broad diffusion of gay and lesbian people into American social networks is not something that campaigns can simply write into their communications strategy. Some advocates are trying: Planned Parenthood recruited female canvassers in Southern California to talk with voters about abortion, and during the conversation the canvasser revealed that she had personally had an abortion. But research has shown that women who have had abortions are most likely to share their stories with people they perceive as being most sympathetic; for many gay and lesbian people, coming out is a defining experience and a central part of their identity. Examples of their coming out to conservative parents abound. On the issue of climate change, Americans would be hard pressed to share a personal story about how the issue has touched them personally, since most do not believe that their lives have really been affected by it.

Third, few Americans believe that one side will inevitably prevail in the debates over abortion and climate change. The opposing forces are well funded and organized, and can rely on political allies at the federal, state and local level.

Finally, there is no indication that the growing comfort with human sexuality will benefit abortion-rights advocates or — obviously — those battling climate change. Abortion is the one issue about which Americans have not become more accepting, while climate change would seem to have little to do with alternative social arrangements and personal behaviors.

None of this is to say that these advocates, organizations and movements are doomed to failure. But their success probably lies along a different path.