Exactly six months ago, San Francisco Mayor Gavin Newsom (search) sparked equal parts elation and outrage when he allowed same-sex couples to get married in the famously gay-friendly city — even taking part by officiating at some unions.

On Thursday, the California Supreme Court (search) was set to decide if Newsom exceeded his authority.

Legal experts — and even the Democratic mayor — assume the court will rule Thursday that Newsom's actions violated state laws defining marriage as a union between a man and a woman. What's less clear is how the seven justices will treat the thousands of same-sex marriages that were sanctioned before the court intervened in March.

"It appears quite obvious the court is going to rule against the mayor," Kate Kendell, executive director of the National Center for Lesbian Rights (search), said Wednesday. "We think that's unfortunate and it's wrong, but of course the more human question is what to do with 4,037 marriage licenses that belong to couples in relationships and with families."

Gay rights advocates say the most they can hope for is that the justices will say nothing — at least for now — about the validity of licenses gay couples received at San Francisco City Hall between Feb. 12 and March 11, the day the court issued an injunction halting the unprecedented wedding spree.

The city, as well as several legal groups, sued the state the same day, alleging that California's marriage laws as written are an unconstitutional abridgment of the civil rights of gays and lesbians. Those cases, which echo arguments leading to the legalization of gay marriage in Massachusetts, are scheduled to be heard later this year in San Francisco County Superior Court.

Thursday's opinion will not address the constitutional question, however.

The ruling "is important, but it will not resolve whether same-sex couples have the right to marry and be treated equally under our state constitution," said Jennifer Pizer, a lawyer with the Lambda Legal Defense and Education Fund, a gay rights legal aid group.

Larry Levine, a professor at the McGeorge School of Law at the University of the Pacific, said while it was doubtful the justices would declare the marriages valid, they have another option besides ruling them invalid.

"The middle position would be to keep those marriages on hold because the court is going to have to decide the ultimate question anyway," Levine said. "In my opinion, that would be the most hopeful result that could be expected."

Lawyers for the state and a Christian legal organization that filed the pair of cases challenging the mayor's decision have asked the court to nullify the disputed marriage licenses if it finds that Newsom's action was unlawful.

"There was no expectation these licenses were valid from the beginning, and to put off for a later day is simply to invite more lawless conduct and lot of repetitive litigation that will come to the same answer," said Jordan Lorence, the Alliance Defense Fund lawyer who argued the case before the justices May 26.

Gay rights groups have organized rallies to follow the Supreme Court's ruling Thursday, and whatever the result, called for same-sex couples to show up at their county clerk's office on Friday requesting a marriage license.