The court said the city violated the law when it issued the certificates, since both legislation and a voter-approved measure defined marriage as a union between a man and woman.
The justices separately decided with a 5-2 vote to nullify the marriages performed between Feb. 12 and March 11, when the court halted the weddings. Their legality, Justice Joyce Kennard wrote, must wait until courts resolve the constitutionality of state laws that restrict marriages to opposite-sex couples.
"It's as if those licenses never were issued, and now those couples have some decisions to make about whether they want to initiate further legal action in the event they relied upon those licenses," says CBS News Legal Analyst Andrew Cohen. "This ruling is not the ultimate ruling on the constitutionality of same-sex marriages - that ruling comes later this year and could very well come out differently."
The same-sex marriages had virtually no legal value, but powerful symbolism. Their nullification by the high court dismayed Del Martin and Phyllis Lyon, the first same-sex couple to receive a marriage license in San Francisco.
"Del is 83 years old and I am 79," Lyon said. "After being together for more than 50 years, it is a terrible blow to have the rights and protections of marriage taken away from us. At our age, we do not have the luxury of time."
The court did not resolve whether the California Constitution would permit a same-sex marriage, ruling instead on the narrow issue of whether local officials could bypass state judicial and legislative branches.
Chief Justice Ronald George noted that Thursday's ruling doesn't address "the substantive legal rights of same sex couples. In actuality, the legal issue before us implicates the interest of all individuals in ensuring that public officials execute their official duties in a manner that respects the limits of the authorities granted to them as officeholders."
The justices agreed to resolve the legality of the weddings sanctioned by Mayor Gavin Newsom after emergency petitions were filed by a conservative group and the state's top law enforcement official, Attorney General Bill Lockyer.
"There wasn't much of a legal argument backing the actions of the San Francisco mayor and once the court decided that he did not have the authority to grant those licenses, it necessarily followed that the licenses themselves would be voided," says Cohen.
San Francisco's same-sex weddings, which followed a landmark ruling by Massachusetts' top court allowing same-sex marriage — prompted President Bush to push for changing the U.S. Constitution to ban same-sex marriage, an effort that has become campaign fodder this election year.
The California court sided with Lockyer's arguments, ruling that Newsom's actions would foment legal anarchy and sanction local officials to legislate state law from city halls or county government centers.
When the justices agreed in March to hear the case, they said they would decide only whether Newsom overstepped his mayoral powers for now, but would entertain a constitutional challenge — that gays should be treated the same as heterosexual couples under the California Constitution — if such a lawsuit worked its way to the justices through the lower courts.
Gay and lesbian couples immediately acted on that invitation, suing in San Francisco County Superior Court alleging laws barring them from marrying were discriminatory. Mayor Newsom filed a similar lawsuit.
The now-consolidated cases are unlikely to reach the California Supreme Court for at least a year or more. California lawmakers have refused to take a position on the matter, and have left the politically volatile issue to its Supreme Court.
Newsom argued to the justices in May that the ability of same-sex couples to marry was a "fundamental right" that compelled him to act. Newsom authorized the marriages by citing the California Constitution's ban against discrimination, and claimed he was duty-bound to follow this higher authority rather than state laws banning same-sex marriage.
The Arizona-based Christian law firm Alliance Defense Fund, a plaintiff in one of two cases the justices decided Thursday, had told the justices that Newsom's "act of disobedience" could lead other local officials to sanction "polygamists."
Newsom's defiance of state law created huge lines at City Hall by gays and lesbians waiting to be married, and ignited a firestorm engulfing statehouses and ballot boxes nationwide.
Missouri voters this month endorsed a state constitutional amendment banning same-sex marriage — a move designed to prevent that state's judiciary from agreeing with the arguments Newsom is making in California.
A state constitutional challenge by gays in Massachusetts prompted that state's highest court to endorse the same-sex marriages that began there in May. A judge in Washington state this month also ruled in favor of same-sex marriage, pending a resolution from that state's top court.
Louisiana residents are to vote on the same issue Sept. 18. Then Arkansas, Georgia, Kentucky, Mississippi, Montana, Oklahoma, Oregon and Utah are to vote Nov. 2. Initiatives are pending in Michigan, North Dakota and Ohio.
Four states — Alaska, Hawaii, Nebraska and Nevada — already have similar amendments in their constitutions.