(Curt Merlo/For The Washington Post)

Kerry Eleveld is a writer for Daily Kos and the author of “Don’t Tell Me to Wait: How the Fight for Gay Rights Changed America and Transformed Obama’s Presidency.”

Just three days after President Obama reminisced that “one of the most special moments” of his presidency came when the White House was awash in rainbow colors following last year’s marriage-equality ruling, he stood in the White House briefing room and sought to console a nation reeling from the slaughter of at least 49 people at a gay nightclub in Orlando.

If the validation of same-sex marriage was a high point, this was no doubt one of the lowest. In contrast to the advancement of gay and transgender rights, which has been among the standout successes of the progressive agenda during the Obama years, the failure to pass gun-safety measures that could prevent more mass shootings has been among the greatest disappointments.

But it wasn’t all that long ago that same-sex marriage seemed just as hopeless a cause as meaningful gun laws seem now. And the reason many Americans — including Obama — changed their minds about gay marriage may be the same reason people eventually change their minds about guns.

If you had asked nearly anyone in the United States a decade ago whether same-sex couples in all 50 states would be able to legally wed by 2015, they might have laughed you out of the room. Yes, gay marriage was legal in Massachusetts. But the movement was in the midst of losing a string of anti-gay-marriage ballot measures, and Gallup polls showed national support for the freedom to marry softening, dropping to 37 percent.

As we all know, public opinion would shift again dramatically. By the time the Supreme Court released its opinion in Obergefell v. Hodges , 60 percent of Americans supported marriage equality. Political scientists still marvel at this rapid turnaround, but the prevailing explanation is that contact with someone who is openly gay leads to more positive attitudes toward gay rights. In 1992, a majority of Americans — 56 percent — said they didn’t know anyone who was lesbian or gay; but by 2010, the same CBS News poll found that number had fallen to just 22 percent. As gay people came out to their communities in increasing numbers and with greater visibility, they destroyed stereotypes and provided a personal attachment to the issue for millions of Americans, creating an urgency that wasn’t there before.

When Obama finally embraced marriage equality in 2012, he told ABC News’s Robin Roberts , “When I meet gay and lesbian couples, when I meet same-sex couples, and I see how caring they are, how much love they have in their hearts, how they’re taking care of their kids — when I hear from them the pain they feel that somehow they are still considered less than full citizens . . . it just has tipped the scales.”

We heard a similar account this past week from conservative Utah Lt. Gov. Spencer Cox, who apologized for being unkind to gay individuals at earlier points in his life. “My heart has changed,” Cox said, “. . . because I have gotten to know many of you.” In his remarks, Cox went on to identify with the victims killed in Orlando. “They each had dreams, goals, talents, friends, family,” he said. “They are you, and they are me. And one night they went out to relax, to laugh, to connect, to forget, to remember. And in a few minutes of chaos and terror, they were gone.”

Because so many Americans now have personal connections to people who are gay, bisexual or transgender, the Pulse nightclub massacre has hit the nation hard — in a way that, for instance, the 1973 arson that killed 32 people at a gay bar in New Orleans couldn’t. And just as knowing gay people helped shift attitudes about same-sex marriage, knowing or identifying with victims of gun violence can help generate urgency for laws designed to prevent more tragedies.

On a national level, attitudes about firearms have tended to be stubborn. Even shortly after mass shootings — at Virginia Tech in 2007, in Tucson, Ariz., in 2011 and at a movie theater in Aurora, Colo., in 2012 — the Pew Research Center found no significant change in support for “gun control” vs. “gun rights.” The nation remained more or less evenly divided on the matter, with survey respondents typically viewing the shootings as “isolated acts” that weren’t related to “broader social problems.” There was a slight increase in support for gun control immediately after the 2012 shooting at Sandy Hook Elementary, but support for gun rights began to rise again soon after.

People are more receptive when asked about “gun safety” rather than “gun control,” and some specific policies, including universal background checks, routinely enjoy the approval of anywhere from 70 to 90 percent of Americans. But it’s been tough to translate that approval to national policies in recent decades. The 1999 Columbine shooting energized efforts to close the “gun show loophole” and mandate background checks for firearms purchased at gun shows. But none of the bills introduced in Congress passed. Likewise, in the wake of the Sandy Hook shooting, Obama proposed an ambitious slate of gun reform initiatives, including universal background checks, a reinstatement of the federal assault-weapons ban, a ban on armor-piercing bullets and restrictions on the number of rounds allowed in ammunition magazines. He wasn’t able to get any of it through Congress. And his executive actions have been so modest that even a National Rifle Association lobbyist dismissed them, saying, “They’re not really doing anything.”

This past week, it took Democratic senators nearly 15 hours of filibustering to get agreement from Republican leaders on just scheduling a vote on gun measures. And those measures — which include expanding background checks and preventing suspected terrorists from buying guns — are almost certain to fail.

But if you look at the state and local responses near where mass shootings have happened, you’ll often find greater urgency in public opinion and greater success in passing gun safety laws.

After Sandy Hook, for instance, 54 percent of Connecticut voters said they were more likely to support gun control than they had been before. And support for universal background checks among the state’s voters hit 93 percent, the highest any issue had polled in the state in 20 years of Quinnipiac surveys.

As a result, while the national effort faltered, Connecticut passed one of the nation’s toughest gun safety laws. The legislation banned high-capacity magazines, armor-piercing bullets and more than 100 additional assault weapons. It imposed background checks on all purchases and created the first statewide registry of people convicted of weapons offenses. After signing the law in 2013, Gov. Dan Malloy (D) not only won reelection but did nine points better in Newtown, the site of the shooting, against his Republican competitor, Tom Foley, than he had against Foley four years earlier. Malloy was also one of the few Democratic governors to survive the GOP wave of 2014; his counterparts in the progressive states of Massachusetts, Maryland and Illinois all lost their seats to Republicans.

Colorado, although a Western state with a strong tradition of gun ownership and historically lax firearm laws, also pushed to address gun safety after Columbine and again after Aurora. In 2000, the state’s voters overcame obstruction in the Republican-controlled legislature and overwhelmingly approved a ballot measure to close the gun show loophole. In 2013, a Democratic-led legislature passed laws mandating background checks for online and private gun sales and instituting a ban on ammunition magazines holding more than 15 rounds. Some Colorado lawmakers subsequently lost their seats over their support for the gun measures, and there have been efforts to repeal the laws. But once on the books, such laws rarely come off.

Colorado Gov. John Hickenlooper (D) wrote last month in Time that he had been somewhat reluctant to sign the gun bills. But the night before, he got a call that the state’s head of corrections had been shot and killed. That personal connection to a victim of gun violence, someone who “worked in a cold, hard world with a remarkably warm and tender heart,” fortified his opinion that Coloroado needed new gun laws.

Of course, not every state succeeds in reforming its gun laws after high-profile shootings in one of its cities or towns. Even after the carnage in Orlando, gun safety advocates aren’t optimistic about lawmakers passing any new legislation in Florida, sometimes known as the Gunshine State — despite the fact that its voters have twice approved ballot measures strengthening gun safety laws. And NRA lobbying always presents a formidable counterweight to public opinion.

But the unfortunate reality is that we are fast becoming a nation of communities that are synonymous with carnage. Columbine, Aurora, Newtown, San Bernardino, Orlando — they are Anytown, USA. Active shooter situations have been happening more and more frequently, according to the FBI. Yet mass shootings represent only a sliver of the gun violence in this country. The nonprofit website Gun Violence Archive tracked more than 53,000 incidents last year, documenting 13,430 deaths and 27,008 injuries. An estimated 20 percent of Americans say they’ve been threatened or shot at with a gun.

The effects of gun violence ripple much further. One in three Americans say they know a friend or relative who has been a victim of gun violence. A recent Huffington Post/YouGov poll found that 22 percent of Americans say they know someone who was fatally shot by someone else, with an additional 29 percent saying they know someone who committed suicide using a gun. Those are shocking numbers, considering the stakes. And sadly, an ever-growing cross-section of communities can imagine their schools, their workplaces, their places of worship, their movie theaters and now their nightclubs being attacked.

This is the reality that could create a critical mass of voters who not only prioritize gun safety but become single-issue voters on the matter. And at some point, the United States could reach a political tipping point on gun safety, just like it did on same-sex marriage.

Twitter: @kerryeleveld

Read more from Outlook and follow our updates on Facebook and Twitter.