In the two years since same-sex marriage was legalized nationwide, support for it has surged even among groups that recently were broadly opposed, according to a new national survey.

The Pew Research Center survey found that for the first time, a majority of blacks and baby boomers support allowing gays and lesbians to wed. It said Republicans are now split almost evenly, a marked shift from 2013, when 61 percent opposed gay marriage.

Pew's survey was conducted by telephone among 2,504 adults across the U.S. from June 8 to 18. It was released Monday, the second anniversary of the U.S. Supreme Court's historic ruling on same-sex marriage.

In the aftermath of that ruling, there were some flare-ups of defiance. A county clerk in Kentucky, Kim Davis, refused to issue marriage licenses to same-sex couples. Alabama's chief justice, Roy Moore, ordered probate judges to stop issuing such licenses.

Obama on Marriage Equality: Justice "Like a Thunderbolt"

President Barack Obama made comments about the Supreme Court ruling in support of national marriage equality.

(Published Friday, June 26, 2015)

But such acts of resistance have largely faded way, and same-sex marriage is now treated as a routine occurrence across the U.S. According to the Williams Institute at UCLA School of Law, there are now more than 547,000 same-sex married couples in the U.S., including at least 157,000 couples who married in the past two years.

Some staunch opponents of gay marriage are now focusing their efforts on trying to provide legal protections to civil servants, merchants and other business people who do not want to provide services to same-sex couples. Mississippi, for example, has passed a law — now the subject of litigation in federal court — that would let businesses and government workers deny some services to gay and lesbian couples.

There's a case now pending before the Supreme Court involving a Colorado baker who was found guilty of discrimination for refusing to sell a gay couple a wedding cake. A florist in Washington state also is expected to appeal to the high court after she was fined for violating that state's anti-discrimination law because she would not provide flowers for a same-sex wedding.

—Support is more than 70 percent among millennials aged 18 to 36, and among Democrats and Democratic-leaning independents. Support is only 35 percent among white evangelical Protestants, while it is 67 percent among Roman Catholics.

However, among the Catholic leadership in the U.S., opposition to same-sex marriage remains strong. Just two weeks ago, the head of the diocese of Springfield, Illinois — Bishop Thomas Paprocki — issued a decree stipulating that gays and lesbians in same-sex marriages should not be provided with communion or Catholic funeral services.

Francis DeBernardo, head of an organization of LGBT Catholics called New Ways Ministry, addressed an open letter to Paprocki on Friday.

"Many gay and lesbian couples are leading lives of heroic devotion to each other, their children, and their communities," DeBernardo wrote. "I hope and pray that you will reflect not only on the harm that this decree will cause but also the good that can occur if you withdraw it."

'Ellen': Caitlyn Jenner Talks Same-Sex Marriage

Caitlyn Jenner discusses how her thinking on same-sex marriage has changed over the years.