California's Supreme Court upheld a ban on gay marriage but said some 18,000 same-sex weddings carried out before the ban took effect would remain valid.
Gay and lesbian activists had sought to overturn the result of a November referendum known as Proposition 8 that redefined marriage in California as unions between men and women only.
But California Supreme Court justices said in a six to one majority opinion that the referendum -- which passed by a margin of 52.5 to 47.5 percent -- was legal and could not be quashed.
The decision was a bitter blow for same-sex marriage advocates, who held protests outside the court and across California on Tuesday.
"There's no way to sugarcoat it; this is a very sad day for our community," said Shannon Minter, legal director for the National Center for Lesbian Rights and an attorney who had argued in court for the referendum to be overturned.
Minter said activists would now seek to place the issue back before voters in a further referendum.
"Today's decision is a terrible blow ... But our path ahead is now clear. We will go back to the ballot box and we will win," Minter said.
Around 175 protesters were arrested in San Francisco after blocking a street near the court house in a peaceful demonstration. Chants of "Shame on you, shame on you" rang out after the ruling as protestors voiced dismay.
A crowd of nearly 1,000 demonstrators rallied at the steps of San Francisco's City Hall at about 6:00 pm (01h00 GMT). Placards waved above the throng bore messages such as "Fight Back" and "Ignorance Breeds Hate."
"We have to hit the ballots as soon as possible; no waiting," said Scott Acosta, 34, who married his 26-year-old husband Michael a day before the November vote in favor of the ban.
Ray Roldan, 29, said he is certain that one day he will be able to marry a partner of his choosing. "I know who I am and I know what I want," Roldan said. "I still believe in God and I know God wouldn't want hate. I'm not married yet, but it is going to happen."
California Governor Arnold Schwarzenegger meanwhile urged protestors to respond "peacefully and lawfully."
"While I believe that one day either the people or courts will recognize gay marriage ... I will uphold the decision of the California Supreme Court," he said.
As gay marriage supporters condemned the ruling, opponents applauded it as a righteous affirmation of traditional families.
"Today's decision is a victory for democracy and a victory for the civil rights of clergy, county clerks and Californians across the political spectrum who did not want to be forced by the government to approve of same-sex marriage," said Brad Dacus, president of the Pacific Justice Institute, a conservative group that supported Proposition 8.
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.
The latest California ruling comes after a rollercoaster 12 months that have seen activists on both sides of the same-sex marriage debate lurch from jubilation to despair.
Last May, California's Supreme Court voted four to three to legalize same-sex marriage, delighting gay activists in the most populous US state and sending thousands of same-sex couples rushing to tie the knot.
But the subject was forced back onto the political agenda by religious and social conservative groups, who gathered enough support for the issue to be put before voters at November 4 polls.
Rights activists later challenged the referendum, arguing it was an illegal revision of the state constitution.