SAN FRANCISCO (AP) — Backed by rainbow flags and confetti, thousands celebrated in California’s streets after U.S. Supreme Court rulings brought major advances for gay marriage proponents in the state and across the country.

Though wedding bells may be weeks away, same-sex couples and their supporters filled city blocks of San Francisco and West Hollywood on Wednesday night to savor the long-awaited decisions as thumping music resounded.

“Today the words emblazoned across the Supreme Court ring true: equal justice under law,” said Paul Katami, one of the plaintiffs who challenged California’s gay marriage ban, as he celebrated in West Hollywood.

In one of two 5-4 rulings, the high court cleared the way for gay marriages to resume in California, holding that the coalition of religious conservative groups that qualified a voter-approved ban for the ballot did not have the authority to defend it after state officials refused. The justices thus let stand a San Francisco trial court’s ruling in August 2010 that overturned the ban.

In the other, the court wiped away part of a federal anti-gay marriage law, the Defense of Marriage Act, or DOMA, putting legally married gay couples on equal federal footing with all other married Americans, allowing them to receive the same tax, health and pension benefits.

The court sidestepped the larger question of whether banning gay marriage is unconstitutional, and states other than California and the 12 others where gay couples already have the right to wed were left to hash out the issue within their borders.

As the sun set on San Francisco, a crowd surged from hundreds to several thousand in the city’s Castro neighborhood, with rainbow flags and confetti filling the air.

James Reynolds, 45, was among the revelers, saying he had been married to his partner of 23 years several times, including once in California.

“It’s been taken away from us,” Reynolds said as he stood in a crosswalk near the barrier blocking off the street for the celebration. “But we’ll be married again.”

In Southern California, an all-day celebration in West Hollywood grew to hundreds by night, including many gay couples dressed in red, white and blue and one sign that read “Today we are American.”

Brendan Banfield, 46, stood on the very spot under a tree in West Hollywood Park where in 2008 he married his partner, Charles, becoming one of an estimated 18,000 couples that got married during the 4½ four months when gay marriage was legal in California.

“I want to cry,” Banfield said. “It’s been a long journey. I’m grateful I’m alive to see it.”

It remained unclear, however, when California’s gay marriages might start again. Backers of the ban known as Proposition 8 have 25 days to ask the Supreme Court to reconsider. The 9th U.S. Circuit Court of Appeals also must lift a hold it placed on the lower court order before the state can be free to issue marriage licenses to same-sex couples.

Still, state officials moved quickly. Gov. Jerry Brown said he had directed the California Department of Public Health to start issuing licenses as soon as the hold is lifted, and state Attorney General Kamala Harris went even further, publicly urging the appellate court to act ahead of the final word from the Supreme Court.

In the DOMA decision, Justice Anthony Kennedy, joined by the four liberal justices, said the purpose of the federal law was to impose a disadvantage and “a stigma upon all who enter into same-sex marriages.”

Justice Antonin Scalia issued a pungent dissent, predicting that the ruling would be used to upend state restrictions on marriage, reading aloud in a packed courtroom that included two couples who sued for the right to marry in California.

“It takes real cheek for today’s majority to assure us, as it is going out the door, that a constitutional requirement to give formal recognition to same-sex marriage is not at issue here,” Scalia read.

“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 case and hoped states continue to define marriage as the union of a man and a woman.

Without offering any specifics about their next move, lawyers for Proposition 8 sponsors insisted state officials remained obligated by the California Constitution to enforce the ban, and that the ruling only legalized marriage for the two couples who sued to overturn it.

“What was sought in this lawsuit was a 50-state mandate or to establish there is a fundamental right to same-sex marriage, which the Supreme Court did not rule today,” said Austin Nimiocks, senior counsel for the Alliance Defending Freedom.

But opponents responded by qualifying Proposition 8 for the ballot, and it passed with 52 percent of the vote.

Katami, the Proposition 8 co-plaintiff, said he and longtime partner Jeff Zarrillo were seeking status only a legal wedding could provide.

“There was something about that word marriage and what it meant,” Katami said. “Something about the celebration and the right, the language and the association across the globe that comes with the word marriage.”

___

Associated Press writers Mihir Zaveri in San Francisco and Sarah Parvini in West Hollywood contributed to this report.