SAN FRANCISCO — In 1958, the Gallup Poll asked Americans whether they approved or disapproved of marriage between blacks and whites. The response was overwhelming: 94% were opposed, a sentiment that held for decades. It took nearly 40 years until a majority of those surveyed said marriage between people of different skin colors was acceptable.

By contrast, attitudes toward gays and lesbians have changed so much in just the last 10 years that, as Gallup reported last week, “half or more now agree that being gay is morally acceptable, that gay relations ought to be legal and that gay or lesbian couples should have the right to legally marry.” (In 1996, when Gallup first asked about legalizing same-sex marriage, 68% of Americans were opposed.)

Politically, President Obama felt it safe enough recently to abandon his studied ambiguity and endorse same-sex marriage amid a tough reelection campaign. Days later, a top Republican pollster, Jan van Lohuizen, issued a warning to his party, suggesting opponents were on the wrong side of the issue. Support has grown, he wrote in a strategy memo, “at an accelerated rate with no sign of slowing down.”

If, as the Rev. Martin Luther King Jr. once said, the arc of the moral universe is long but bends toward justice, then it’s arguably moving faster and bending quicker in the direction of gay rights than any civil rights movement before.

That is not to say that gays and lesbians enjoy a full measure of equality, or complete legal protection. Same-sex marriage is forbidden in the vast majority of states and, in many, gays and lesbians lack the protections against job and housing discrimination afforded women, Latinos and African Americans.

Just last week, Republicans in the Colorado House stymied a measure recognizing civil unions between gay couples, calling it an attempted end-run around the state’s constitutional ban on same-sex marriage. In Virginia, GOP lawmakers blocked a prosecutor from becoming the state’s first openly gay judge.

Still, “it’s pretty extraordinary what we’ve accomplished in less than 50 years,” said Cleve Jones, who has spent decades as a gay rights activist, starting in the 1970s as a protege of San Francisco Supervisor Harvey Milk.

“Homosexual behavior itself was a felony almost everywhere,” Jones recalled. “There were laws on the books preventing us from congregating in bars and restaurants. There were special police units in every single city whose job was to entrap and arrest and imprison us. … There’s been enormous progress, astonishing progress.”

Jones, like many, was loath to compare civil rights movements. “African Americans essentially wrote the book on how to do a social movement in the United States,” said Gary M. Segura, head of Stanford University’s Chicano studies program.

There is not even agreement on when the movements began. For blacks, some say it was the end of the Civil War in 1865 or the founding of the National Assn. for the Advancement of Colored People in 1909. For gays and lesbians, some cite the homophile movement of the 1950s, while others point to the explosion of activism after the 1969 Stonewall riots in New York.

Nor is there consensus on how to measure progress, or a lack thereof. Is it economic gains? Is it the ability of gays and lesbians to marry? Or the inability of black men in certain cities — even with a black president — to successfully hail a cab after dark?

Regardless, by moving public opinion so dramatically and changing the political dynamic with such rapidity, the gay rights movement has achieved remarkable success with unprecedented speed — to a point where some criticized Obama as a laggard when he endorsed same-sex marriage, a historic move unthinkable just a few years ago.

In a convergence of causes, the NAACP board voted Saturday to endorse same-sex marriage, saying “marriage equality” was “consistent with equal protection under the law provided under the 14th Amendment of the United States Constitution.”

Several reasons account for the success. The gay community tends to be more affluent, and the ability to give generously to candidates has translated into significant political clout, from the local level to the White House. Its leaders are well-versed in the machinations of government and the means of power, knowledge hard-won through years spent dragging politicians into the fight against the AIDS epidemic.

But experts and advocates agree on one explanation above all others: Familiarity.

“People came to understand we existed,” Jones said. “They worked with us. They knew us. They had [gay] family members. That demystified it and made it harder for them to hate us in an abstract way.”

That was an avenue obviously unavailable to African Americans. “It isn’t as if white people suddenly come to discover they have African American children or relatives,” said Kenneth Sherrill, a professor at Hunter College in New York and a longtime gay activist.

Gays and lesbians “are born into straight families and live in straight neighborhoods and go to straight schools and work in straight businesses,” Sherrill said. “There’s a kind of familiarity that’s exceedingly difficult to achieve in the case of race.”

Popular culture and its shaper, the mass media, have also played a crucial role in changing attitudes, much as news accounts helped advance the cause of the black civil rights movement. Only this time it wasn’t images of fire hoses and police dogs turned on innocents but the sympathetic portrayal of gay and lesbian characters in prime time, in what has become a TV staple.

“Will & Grace,” the NBC comedy that ran from 1998 to 2006, “probably did more to educate the American public than almost anything anybody’s ever done so far,” Vice President Joe Biden said in a “Meet the Press” interview that helped prod Obama off the fence into supporting same-sex marriage.

That may be hyperbolic, but many said the vice president hit on something important: that welcoming fictionalized gay characters into the home made it that much easier to welcome gays and lesbians as family, friends, neighbors and co-workers in real life.

“It is certainly the case that gays and lesbians have been widely accepted in popular culture in a way that you could argue blacks in particular and Latinos too have never really been accepted,” said Frank Gilliam, an expert on politics and race at UCLA.

He hastened to suggest, however, that such comparisons missed a larger point.

“I can’t say how much worse your not being able to marry is than me being stopped [by police] for the color of my skin,” Gilliam said. “To me, the question is not whether homophobism or racism is worse or better. The question is what kind of society do we want to want to live in? What kind of society do we want to raise our children in?”

mark.barabak@latimes.com