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.

Ikeita Cantu, left, and her wife Carmen Guzman, of McLean, Va., hold up signs as they celebrate outside of the Supreme Court in Washington on June 26, 2015, after the court declared that same-sex couples have a right to marry anywhere in the U.S. Jacquelyn Martin / AP

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.

Related: Supreme Court Agrees to Hear Appeal in Gay Wedding Cake Case

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.

Some of the notable findings in the Pew survey:

—Overall, 62 percent of Americans now support same-sex marriage, the highest level in 20 years of Pew polling on the issue. As recently as 2010, support was at 42 percent.

—Among baby boomers, support is now at 56 percent — up from 46 percent a year ago.

—Support among blacks has risen from 39 percent to 51 percent over two years.

—Among Republicans and Republican-leaning independents, 48 percent oppose same-sex marriage and 47 percent support it. In 2013, 61 percent were opposed.

—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.

RELATED: Arkansas Must List Same-Sex Parents' Names on Birth Certificates

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.”

Follow NBC Out on Twitter, Facebook and Instagram