SAN FRANCISCO - California's Supreme Court on Tuesday upheld a referendum which outlawed gay marriage but said 18,000 same-sex weddings carried out before the vote would remain legally valid.
Gay and lesbian activists had been seeking to overturn the results of the November referendum which redefined marriage in California as being unions between men and women only.
Opponents said the referendum -- known as Proposition 8 -- was an illegal revision of the state's constitution and that the rights of minorities should not be vulnerable to a simple majority vote.
However the California Supreme Court justices said in a 6-1 majority opinion that the referendum -- which passed by a margin of 52.5 to 47.5 percent -- was legal and should be allowed to remain.
The decision is a setback for gay-rights activists, who recently celebrated victories elsewhere in the United States.
Crowds gathered outside the California Supreme Court building on Tuesday more than an hour before the ruling, and police set up barricades.
One same-sex marriage opponent carried a sign proclaiming: "Gay = Pervert."
Gay marriage supporters carried the rainbow flags that are symbols of the gay-rights movement. After the ruling was released, some of them chanted: "Shame on you, shame on you."
Tuesday's decision comes at a time when several other US states have introduced laws allowing same-sex marriage.
Maine, Connecticut, Massachusetts, Vermont, and Iowa have all extended full marriage rights to gay couples, while New Hampshire and New York have edged closer to adopting such a law.