In two rulings considered victories for gay marriage supporters, the U.S. Supreme Court ruled Wednesday that legally married same-sex couples should get the same federal benefits as heterosexual couples and cleared the way for same-sex marriage in California.

Some in the crowd outside the court hugged and others jumped up and down just after 10 a.m. ET Wednesday when the DOMA decision was announced. Many people were on their cellphones 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.

In one of the rulings, the court invalidated a provision of the federal Defence of Marriage Act that has prevented married gay couples from receiving a range of tax, health and retirement benefits that are generally available to married people. The vote was 5-4.

Justice Anthony Kennedy wrote the majority opinion.

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

He was joined by the court's four liberal justices.

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

Scalia read his dissent aloud. He said the court should not have decided the case.

But, given that it did, he said, "we have no power under the constitution to invalidate this democratically adopted legislation."

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

On the issue of California's Proposition 8, which banned gay marriage in the state, the court ruled that defenders of the ban did not have the right to appeal lower court rulings striking down the ban.

The court's 5-4 vote Wednesday on that decision leaves in place the initial trial court declaration that the ban is unconstitutional. California officials may rely on that ruling to allow the resumption of same-sex unions in about a month's time.

The high court itself said nothing about the validity of gay marriage bans in California and roughly three dozen other states.

The outcome was not along ideological lines.

Roberts wrote the majority opinion, joined by Justices Ruth Bader Ginsburg, Stephen Breyer, Elena Kagan and Scalia.

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

Four justices, Kennedy, Alito, Thomas and Sonia Sotomayor, said the court should have decided the constitutional question that was before it.

Later Wednesday, a federal appeal court said it will wait at least 25 days before making a decision on whether gay marriages can resume in California.

The 9th U.S. Circuit Court of Appeals said backers of Proposition 8 — the state ban on gay marriages — have that long to ask the Supreme Court to rehear the case.

The San Francisco-based court said it may continue to bar gay marriages even beyond that time if proponents of Proposition 8 ask for a rehearing.

"While it is unfortunate that the court's ruling does not directly resolve questions about the scope of the trial court's order against Prop 8, we will continue to defend Prop 8 and seek its enforcement until such time as there is a binding statewide order that renders Prop 8 unenforceable," said Andy Pugno, a lawyer for the ban's supporters.

Gov. Jerry Brown said he has directed the California Department of Public Health to start issuing marriage licences to gay couples as soon as the appeal court hold is lifted.

Obama says court has 'righted a wrong'

U.S. President Barack Obama is applauding the Supreme Court's decision to strike down the Defence of Marriage Act. Obama says the court "has righted a wrong, and our country is better off for it."

Obama says he has directed Attorney General Eric Holder to work with others in his administration to make sure federal law reflects the court's decision.

He also says that nothing in the decision changes how religious institutions define and consecrate marriage.

The high court rulings are arriving amid rapid change regarding gay marriage. The number of states permitting same-sex partners to wed has doubled from six to 12 in less than a year, with voter approval in three states in November, followed by legislative endorsement in three others in the spring.

At the same time, an effort to legalize gay marriage in Illinois stalled before the state's legislative session ended last month. And 30 states have same-sex marriage bans enshrined in their constitutions.

Massachusetts was the first state to allow same-sex couples to marry, in 2004. Same-sex marriage also is legal, or soon will be, in Connecticut, Delaware, the District of Columbia, Iowa, Maine, Maryland, Massachusetts, Minnesota, New Hampshire, New York, Rhode Island, Vermont and Washington.

Roughly 18,000 same-sex couples got married in California in less than five months in 2008, after the California Supreme Court struck down a state code provision prohibiting gay unions.

California voters approved Proposition 8 in November of that year, writing the ban into the state constitution.

Two same-sex couples challenged the provision as unconstitutional and federal courts in California agreed.

The federal marriage law, known by its acronym DOMA, defines marriage as between a man and a woman for the purpose of deciding who can receive a range of federal benefits. Another provision not being challenged for the time being allows states to withhold recognition of same-sex marriages from other states.

DOMA easily passed Congress and was signed into law by President Bill Clinton in 1996, the year of his re-election.

Several federal district and appeals courts struck down the provision. In 2011, the Obama administration abandoned its defence of the law but continued to enforce it. House Republicans are now defending DOMA in the courts. President Barack Obama subsequently endorsed gay marriage in 2012.

'She would be so pleased'

The challenge to the legislation was spearheaded by 83-year-old Edith Windsor, a New Yorker, who married her longtime partner Thea Spyer six years ago in Toronto.

Edith Windsor, centre, is greeted by a supporter as she arrives with her lawyer Roberta Kaplan, right. The top U.S. court ruled today in favour of Windsor, who sued the federal government for failing to recognize her marriage to her partner Thea Spyer after Spyer's death. (Mike Segar/Reuters)

Same-sex marriage has been legal in Canada for almost a decade. The couple's marriage was recognized by New York state, but not by the federal government.

When Spyer died in 2009, the federal government cited DOMA to force Windsor, who's now ailing, to pay $363,000 in taxes on her late wife's estate — taxes that wouldn't have been levied against her if she'd been married to a man.

"Children born today will grow up in a world without DOMA," a beaming Windsor told a New York news conference.

"And those children who are gay will be free to grow up and love and be married. If I had to survive Thea, what a glorious way to do it. And she would be so pleased."