WASHINGTON (AP) — In a historic victory for gay rights, the Supreme Court on Wednesday struck down a provision of a federal law denying federal benefits to married gay couples and cleared the way for the resumption of same-sex marriage in California.

The justices issued two 5-4 rulings in their final session of the term. One decision wiped away part of a federal anti-gay marriage law that has kept legally married same-sex couples from receiving tax, health and pension benefits.

The other was a technical ruling that said nothing at all about same-sex marriage, but left in place a trial court's declaration that California's Proposition 8 is unconstitutional. Gov. Jerry Brown quickly ordered that marriage licenses be issued to gay couples as soon as a federal appeals court lifts its hold on the lower court ruling, possibly next month.

In neither case did the court make a sweeping statement, either in favor of or against same-sex marriage. And in a sign that neither victory was complete for gay rights, the high court said nothing about the validity of gay marriage bans in California and roughly three dozen other states. A separate provision of the federal marriage law that allows a state to not recognize a same-sex union from elsewhere remains in place.

President Barack Obama praised the court's ruling on the federal marriage act, which he labeled "discrimination enshrined in law."

"It treated loving, committed gay and lesbian couples as a separate and lesser class of people," Obama said in a statement. "The Supreme Court has righted that wrong, and our country is better off for it."

House Speaker John Boehner, R-Ohio, said he was disappointed in the outcome of the federal marriage case and hoped states continue to define marriage as the union of a man and a woman.

The ruling in the California case was not along ideological lines. Chief Justice John Roberts wrote the majority opinion, joined by Justices Ruth Bader Ginsburg, Stephen Breyer, Elena Kagan and Antonin Scalia.

Story continues

"We have no authority to decide this case on the merits, and neither did the 9th Circuit," Roberts said, referring to the federal appeals court that also struck down Proposition 8.

In the case involving the federal Defense of Marriage Act, Justice Anthony Kennedy wrote the majority opinion, joined by the court's liberal justices.

"Under DOMA, same-sex married couples have their lives burdened, by reason of government decree, in visible and public ways," Kennedy said.

"DOMA's principal effect is to identify a subset of state-sanctioned marriages and make them unequal," he said.

Some in the crowd outside the court hugged and others jumped up and down just after 10 a.m. EDT Wednesday when the DOMA decision was announced. Many people were on their cell phones monitoring Twitter, news sites and blogs for word of the decision. And there were cheers as runners came down the steps with the decision in hand and turned them over to reporters who quickly flipped through the decisions.

Chants of "Thank you" and "USA" came from the crowd as plaintiffs in the cases descended the court's marbled steps. Most of those in the crowd appeared to support gay marriage, although there was at least one man who held a sign promoting marriage as between a man and a woman.

Kennedy was joined in the DOMA decision by the court's four liberal justices.

Chief Justice John Roberts, Justices Samuel Alito and Clarence Thomas, and Scalia dissented.

Same-sex marriage has been adopted by 12 states and the District of Columbia. Another 18,000 couples were married in California during a brief period when same-sex unions were legal there.

The outcome is clear for people who were married and live in states that allow same-sex marriage. They now are eligible for federal benefits.

The picture is more complicated for same-sex couples who traveled to another state to get married, or who have moved from a gay marriage state since being wed.

Their eligibility depends on the benefits they are seeking. For instance, immigration law focuses on where people were married, not where they live. But eligibility for Social Security survivor benefits basically depends on where a couple is living when a spouse dies.

The rulings came 10 years to the day after the court's Lawrence v. Texas decision that struck down state bans on gay sex. In his dissent at the time, Scalia predicted the ruling would lead to same-sex marriage.

Massachusetts was the first state to allow gay couples to marry, in 2004. When same-sex unions resume in California, there will be 13 states representing 30 percent of the U.S. population where gay marriage is legal.

The other 11 are Connecticut, Delaware, Iowa, Maine, Maryland, Minnesota, New Hampshire, New York, Rhode Island, Vermont and Washington.

Outside the court, gay marriage proponents celebrated both wins.

May the marriages begin," said the Human Rights Campaign's Chad Griffin, who helped spearhead the lawsuit challenging Proposition 8. The two same-sex couples who sued for the right to marry also were at the court Wednesday.

In New York City's Greenwich Village, the Stonewall Inn, where a riot in 1969 sparked the gay rights movement, erupted in cheers and whooping.

Mary Jo Kennedy, 58 was there with her wife Jo-Ann Shain, 60, and their daughter Aliya Shain, 25.

She came with a sign that could be flipped either way and was holding up the side that says "SCOTUS made our family legal".

They have been together 31 years and got married day it became legal in New York.

The broadest possible ruling would have given gay Americans the same constitutional right to marry as heterosexuals. The justices said nothing on that topic in either case.

The decisions Wednesday have no effect on the roughly three dozen states that do not allow same-sex marriage, including 29 that have enshrined the bans in their constitutions.

The federal marriage law, known by its acronym DOMA, had been struck down by several federal courts.

The justices chose for their review the case of 84-year-old Edith Windsor of New York, who sued to challenge a $363,000 federal estate tax bill after her partner of 44 years died in 2009.

Windsor, who goes by Edie, married Thea Spyer in 2007 after doctors told them Spyer would not live much longer. She suffered from multiple sclerosis for many years. Spyer left everything she had to Windsor.

Windsor would have paid nothing in inheritance taxes if she had been married to a man. And now she is eligible for a refund.

___

Associated Press writers Connie Cass, Jessica Gresko and Bethan McKernan contributed to this report. McKernan reported from New York.