The California Supreme Court struck down the state's ban on same-sex marriage Thursday in a broadly worded decision that would invalidate virtually any law that discriminates on the basis of sexual orientation.

The 4-3 ruling declared that the state Constitution protects a fundamental "right to marry" that extends equally to same-sex couples. It tossed a highly emotional issue into the election year while opening the way for tens of thousands of gay people to wed in California, starting as early as mid-June.

The majority opinion, by Chief Justice Ronald M. George, declared that any law that discriminates on the basis of sexual orientation will from this point on be constitutionally suspect in California in the same way as laws that discriminate by race or gender, making the state's high court the first in the nation to adopt such a stringent standard.

The decision was a bold surprise from a moderately conservative, Republican-dominated court that legal scholars have long dubbed "cautious," and experts said it was likely to influence other courts around the country.

But the scope of the court's decision could be thrown into question by an initiative already heading toward the November ballot. The initiative would amend the state Constitution to prohibit same-sex unions.

The campaign over that measure began within minutes of the decision. The state's Catholic bishops and other opponents of same-sex marriage denounced the court's ruling. But Gov. Arnold Schwarzenegger, who previously has vetoed two bills in favor of gay marriage, issued a statement saying he "respects" the decision and "will not support an amendment to the constitution that would overturn" it.

The ruling was greeted with loud cheering and whooping when it was released at the high court's headquarters here Thursday morning. About 100 people lined up outside to purchase copies of the decision for $10 apiece. Some people bought 10 to 15 copies, calling it a historic document. One man said he planned to give them out as Christmas presents.

Gay groups planned celebrations up and down the state.

"I can finally say I will be able to marry John, the man that I love," said Stuart Gaffney, one of the plaintiffs in the case, referring to his partner of 21 years, John Lewis. "Today is the happiest and most romantic day of our lives."

Conservative and religious-affiliated groups denounced the decision and pledged to bring enough voters to the polls in November to overturn it. Mathew Staver, founder of Liberty Counsel, called the decision "outrageous" and "nonsense."

"No matter how you stretch California's Constitution, you cannot find anywhere in its text, its history or tradition that now, after so many years, it magically protects what most societies condemn," Staver said.

The decision came after high courts in New York, Washington and New Jersey refused to extend marriage rights to gay couples. Only Massachusetts' top court has ruled in favor of permitting gays to wed.

The court's ruling repeatedly invoked the words "respect and dignity" and framed the marriage question as one that deeply affected not just couples but also their children. California has more than 100,000 households headed by gay couples, about a quarter with children, according to 2000 census data.

"Our state now recognizes that an individual's capacity to establish a loving and long-term committed relationship with another person and responsibly to care for and raise children does not depend upon the individual's sexual orientation," George wrote for the majority. "An individual's sexual orientation -- like a person's race or gender -- does not constitute a legitimate basis upon which to deny or withhold legal rights."

Many gay Californians said that even the state's broadly worded domestic partnership law provided only a second-class substitute for marriage. The court agreed.

Giving a different name, such as "domestic partnership," to the "official family relationship" of same-sex couples imposes "appreciable harm" both on the couples and their children, the court said.

The distinction might cast "doubt on whether the official family relationship of same-sex couples enjoys dignity equal to that of opposite-sex couples," George wrote, joined by Justices Joyce L. Kennard, Kathryn Mickle Werdegar and Carlos R. Moreno. All but Moreno were appointed by Republican governors. George was appointed by Gov. Pete Wilson in 1991.

The ruling cited a 60-year-old precedent that struck down a ban on interracial marriage in California.

The three dissenting justices argued that it was up to the electorate or the Legislature to decide whether gays should be permitted to marry.