NEW YORK — Many obstacles still lie ahead for supporters of same-sex marriage, and eventually they will need Congress or the Supreme Court to embrace their goal. For the moment, though, they are jubilantly channeling the lyrics of “New York, New York.”

“Now that we’ve made it here, we’ll make it everywhere,” said prominent activist Evan Wolfson, who took up the cause of marriage equality as a law student three decades ago.

With a historic vote by its Legislature late Friday, New York became the sixth — and by far the most populous — state to legalize same-sex marriage since Massachusetts led the way, under court order, in 2004.

With the new law, which takes effect after 30 days, the number of Americans in same-sex marriage states more than doubles. New York’s population of 19 million surpasses the combined total of Massachusetts, Connecticut, Vermont, New Hampshire and Iowa, plus the District of Columbia.

The outcome — a product of intensive lobbying by Democratic Gov. Andrew Cuomo — will have nationwide repercussions. Activists hope the New York vote will help convince judges and politicians across the country, including a hesitant President Barack Obama, that support of same-sex marriage is now a mainstream viewpoint and a winning political stance.

“New York sends the message that marriage equality across the country is a question of ‘when,’ not ‘if,'” said Fred Sainz, a vice president of the Human Rights Campaign.

Wolfson, president of the advocacy group Freedom to Marry, said the goal is attainable by 2020, or sooner, “if we do the work and keep making the case.”

The work — as envisioned by leading activists — is a three-pronged strategy unfolding at the state level, in dealings with Congress and the Obama administration, and in the courts where several challenges to the federal ban on gay marriage are pending.

“This will be a big boost to our efforts nationally,” said Richard Socarides, a former Clinton White House adviser on gay rights. “It will help in the pending court cases to show that more states are adopting same-sex marriage, and it will help in the court of public opinion.”

The New York bill cleared the Republican-controlled Senate by a 33-29 margin, thanks to crucial support from four GOP senators who joined all but one Democrat in voting yes. The Democratic-led Assembly, which previously approved the bill, passed the Senate’s stronger religious exemptions in the measure, and Cuomo swiftly signed it into law.

Gay rights activists have been heaping praise on Cuomo for leading the push for the bill, seizing on an issue that many politicians of both parties have skirted. Yet the Senate vote marked the first time a Republican-controlled legislative chamber in any state has supported same-sex marriage, and several prominent Republican donors contributed to the lobbying campaign on behalf of the bill.

For those engaged in the marriage debate nationally, recent months have been a political rollercoaster.

Adding those eight states to the six that allow gay marriage, more than 35 percent of Americans now live in states where gay couples can effectively attain the rights and responsibilities of marriage. Just 11 years ago, no states offered such rights.

For now, gay couples cannot get married in 44 states, and 30 of them have taken the extra step of passing constitutional amendments banning gay marriage. Minnesota’s Republican-controlled Legislature has placed such an amendment on the 2012 ballot.

Brian Brown, president of the conservative National Organization for Marriage, vowed to seek defeat of the New York Republicans who helped the marriage bill pass. He also predicted victory for the amendment to ban gay marriage next year in Minnesota, and said this would belie the claims that the same-sex marriage campaign would inevitably prevail nationwide.

“We’ve won every free, fair vote of the people,” Brown said Saturday. “Backroom deals in Albany are not an indication of what people in this country think about marriage.”

Efforts may surface in some states to repeal the existing marriage bans, but the prospect of dismantling all of them on a state-by-state basis is dim. In Mississippi, for example, a ban won support of 86 percent of the voters in 2004.

Thus, looking long term, gay marriage advocates see nationwide victory coming in one of two ways — either congressional legislation or a U.S. Supreme Court ruling that would require all states to recognize same-sex marriages.

“The way you do that is creating a critical mass of states and a critical mass of public opinion — some combination that will encourage Congress and the Supreme Court,” Wolfson said. “By winning New York, we add tremendous energy to the national conversation that grows the majority.”

Shorter term, gay rights activists and their allies in Congress would like to repeal the 1996 Defense of Marriage Act, which denies federal recognition to same-sex marriages. The act is being challenged in several court cases, and Obama ordered his administration in February to stop defending the law on the grounds it is unconstitutional.

Democrats in Congress have introduced a bill to repeal the law, while the Republican leadership in the House has pledged to defend it.

Obama, when elected, said he supported broadening rights for gay couples but opposed legalizing same-sex marriage. More recently, he has said his position is “evolving,” and he asked gay activists at a New York City fundraiser Thursday for patience.

Nonetheless, frustrations are mounting. Freedom to Marry says more than 112,000 people have signed its “Say I Do” appeal to the president, and gay marriage supporters have launched an EvolveAlready campaign on Twitter.

“We hope that, through this public pressure, we’ll be able to move the president to understand that he’s falling behind the majority of Americans who see marriage equality as a key civil right,” said Robin McGehee of the advocacy group GetEqual.

Several recent opinion polls — by Gallup and The Associated Press, among others — have shown that a majority of Americans now approve of same-sex marriage, which a decade ago lagged below 40 percent support. Particularly strong backing for gay marriage among young people, who have grown up watching gay friendly films and TV programs, has prompted many analysts across the political spectrum to suggest the trend is irreversible.

Some conservatives, however, say the opinion polls are belied in the voting booth and point to the steady stream of approvals of state-level bans on same-sex marriage.

“The opposition has created an illusion of momentum but not a real base of support or track record of victory in the courts,” said Brian Raum, senior counsel with the conservative Alliance Defense Fund.

Mary Bonauto would disagree.

An attorney with Boston-based Gay and Lesbian Advocates and Defenders, she has spent two decades battling for legal recognition of same-sex relationships. She helped win the landmark court rulings that led to civil unions in Vermont in 2000 and same-sex marriage in Massachusetts in 2004.

Even in the 1990s, she recalled thinking the cause eventually would prevail nationwide.

“I could see attitudes change,” she said. “Eventually we have to have one standard of justice in this country and establish that sexual orientation is not a basis for discrimination.”

She recalled setbacks just a few years ago in New York — a 2006 Court of Appeals ruling that there was no constitutional right to same-sex marriage in the state, and the decisive defeat of a same-sex marriage bill in the state Senate in 2009.

Vermont lawyer Beth Robinson, now counsel for Gov. Peter Shumlin, worked with Bonauto in the late 1990s on the case that led to the state’s pioneering civil union law. She expects the move toward nationwide same-sex marriage will be bumpy but inexorable.

“As people get to know their gay and lesbian neighbors, friends and family, the notion of denying those families equal rights becomes untenable,” she said. “For New York to go there, on a vote rather that a court order, is huge … It’s a victory not just for New York, but for the whole country.”

Robinson said Vermont, which legalized same-sex marriage in 2009, offered a lesson to wary Americans in other states.

“It isn’t that the sky isn’t falling — it’s more positive than that,” she said. “Vermont is a better place for it. Each of us has the opportunity to be our best selves.”

Among the New Yorkers who will now get that opportunity are Richard Dorr, 84, and John Mace, 91, who have been partners for 61 years while pursuing successful careers as voice teachers in Manhattan.

“We thought about getting married in Massachusetts, but it just didn’t seem to jibe right,” said Dorr. “It should be in the state where you live.”

They plan to seek a marriage license as swiftly as possible but don’t envision a lavish ceremony.

“Just a couple of witnesses and a justice of the peace,” Dorr said.

When they fell in love, back in 1950, “marriage never crossed our mind,” he added. “It was just that we had to be together. We could not stay away.”