WASHINGTON – Gay Americans won their greatest civil rights victory ever Wednesday, as the Supreme Court overturned a long-standing law banning federal benefits for same-sex married couples while also, in effect, restoring gay marriage in California.

For same-sex couples in states such as New York where gay marriage is legal, the impact of the high court action will be profound, as they will now be eligible for more than 1,100 federal benefits that had always been denied to them.

Now those couples will be able to file joint U.S. tax returns. Gay widows and widowers will be eligible for Social Security survivor benefits. And citizens of other countries who wed a same-sex partner who is an American citizen will encounter a much easier path to citizenship.

Yet those may just be the first among the profound changes wrought by the court’s 5-4 decision in U.S. v. Windsor, in which it struck down a key provision of the 1996 Defense of Marriage Act, or DOMA, as an unconstitutional violation of the Fifth Amendment’s guarantee of due process to all citizens.

Gay rights activists see the decision as the first legal chapter in a long journey that will inevitably make gay marriage the law of the land.

“In another five or 10 years, it’s going to be like: What were we arguing about?” said Shari Jo Reich, a Buffalo attorney.

But the Supreme Court rulings also prompted opponents of same-sex marriage to vow to work even harder to stop its spread.

“We cannot surrender to the growing distortion of what God has created marriage to be, even if that distortion has been made law in our own state,” said Bishop Richard J. Malone of the Catholic Diocese of Buffalo.

The high court decided two gay marriage cases Wednesday: the DOMA case and Hollingsworth v. Perry, in which backers of a California referendum banning gay marriage there asked the justices to overturn lower-court rulings that said the ban was unconstitutional.

In that case, a 5-4 court majority ruled that the referendum’s backers did not have standing to bring the case to the Supreme Court. That decision leaves in place a U.S. District Court ruling that re-established gay marriage in California.

While the justices essentially punted on the California case, their ruling in the DOMA case will stand as a landmark. According to the Pew Research Center, the decision will extend the full federal benefits of marriage to at least 71,165 gay married couples nationwide, including 12,285 in New York.

New York is one of 13 states that, along with the District of Columbia, have made same-sex marriage legal in recent years.

To Justice Anthony M. Kennedy and the court majority in the DOMA case, the federal government cannot seek to limit the marriage right that those states have extended to gay couples.

“DOMA seeks to injure the very class New York seeks to protect” by passing a law legalizing gay marriage, Kennedy wrote in his opinion for the court. “By doing so, it violates basic due-process and equal-protection principles applicable to the federal government.”

Justices Ruth Bader Ginsberg, Stephen G. Breyer, Sonia Sotomayor and Elena Kagan joined Kennedy’s majority opinion.

The ruling in the DOMA case, U.S. v. Windsor, reflected the change in public opinion toward favoring gay marriage, but the dissenting justices illustrated how divisive the issue remains.

“In my view a perfectly valid justification for this statute is contained in its title: the Defense of Marriage Act,” said Justice Antonin Scalia, reading part of his dissent from the bench. “Society has the right – it has always had the right – to define and defend that institution.”

While the DOMA opinion will be of obvious benefit to same-sex couples living in places that allow gay marriage, its overall impact will be up to President Obama.

That’s because various agencies have different standards for what constitutes a marriage recognized under federal law.

Some agencies, such as the Social Security Administration and the Internal Revenue Service, base that decision on the state where a couple lives. That means a gay couple married in New York but living in, say, Pennsylvania would not automatically win access to federal benefits because of Wednesday’s ruling.

Other agencies, such as the Department of Defense, recognize marriages based on the state where they take place, not where the married couple resides.

Obama now will have to decide whether to extend gay marriage benefits more broadly by basing them uniformly on the state where a marriage is performed.

Then again, the court did not go nearly as far as it could have. The California case could have resulted in a sweeping finding that the Constitution’s guarantee of equal protection under the law means that gay couples, just like straight couples, can get married in any state.

Instead, the justices decided that the California referendum’s supporters didn’t have legal standing to bring the case to the high court.

“Because we find that petitioners do not have standing, we have no authority to decide this case on its merits, and neither did the Ninth Circuit,” said Chief Justice John G. Roberts Jr., writing for the majority.

That means the District Court decision restoring gay marriage in California is now the law of the state, which will be good news to people such a Kevin Poloncarz, brother of Erie County Executive Mark C. Poloncarz.

“There was always some question as to whether his marriage was in limbo or not,” Mark Poloncarz said of his brother, who lives in San Francisco. “I think with the ruling of the Supreme Court today, he and other gay couples know their marriages are legal.”

In an unusual alignment, Kennedy and Sotomayor dissented in the California case, as did Justices Clarence Thomas and Samuel A. Alito Jr.

While the California ruling has no impact beyond that state, legal experts believe that it’s just the first case on the question of whether gay marriage is a constitutional right.

Kennedy and Scalia seemed to presage that coming debate in what they had to say about the DOMA case.

“By seeking to displace this protection [of marriage] and treating those persons as living in marriages less respected than others, the federal statute is in violation of the Fifth Amendment” – which seems to raise the question: Aren’t state laws banning gay marriage the same kind of violation?

Kennedy said, “This opinion and its holdings are confined to those lawful marriages.”

But Scalia, in his dissent, contended that the court was opening the door to eventually finding a constitutional right to gay marriage.

Opponents of gay marriage vow, of course, that they will fight such cases every step of the way.

“As the American people are given time to experience the actual consequences of redefining marriage, the public debate and opposition to the redefinition of natural marriage will undoubtedly intensify,” said Tony Perkins, president of the Family Research Council.

Despite poll after poll that shows increasing public support for gay marriage, Rep. Timothy A. Huelskamp, R-Kan., promised Wednesday to introduce a constitutional amendment that would define marriage as a union between a man and a woman.

But if you believe Chad Griffin, president of the Human Rights Campaign, the nation’s largest gay rights group, that effort faces long odds and a race against time.

During a joyous rally of gays and their allies on the steps of the Supreme Court, Griffin said, “Within five years, together, we will bring marriage equality to all 50 states.”