For four years, the gay rights movement has clung to the hope that the California Supreme Court would reverse its flagging political and legal fortunes across the country and legalize same-sex marriage.

By one vote, the strategy worked. And gay couples across California can get up this morning and plan their own June weddings for the first time in state history. Only in Massachusetts can couples do that now.

In a ruling that is certain to inflame the social, political and moral debate over gay marriage, a divided state Supreme Court dominated by Republican appointees on Thursday struck down California laws that restrict marriage to heterosexual couples. The 4-3 ruling, written by Chief Justice Ronald George, found that it is unconstitutional to deprive gays and lesbians of the equal right to walk down the aisle with a government-issued marriage license in hand.

“The California Constitution properly must be interpreted to guarantee this basic civil right to all Californians, whether gay or heterosexual, and to same-sex couples as well as to opposite-sex couples,” the court said in a 121-page decision that gives gays unprecedented rights.

The Supreme Court’s ruling will leave an indelible mark on civil rights law, but the next few months may well decide how enduring the result will be for California’s gay and lesbian couples, dozens of whom gathered outside the court Thursday morning awaiting the outcome.

It was just shortly before 10 a.m., when Geoff Kors, a plaintiff in the legal challenge ban, walked out of the of the Supreme Court building, stood on the steps, and signaled the result with a thumbs up to the more than 100 people gathered. The crowd let out whoops, some breaking out in tears. Cheers could be heard for blocks. At one point, sheriff’s deputies and California Highway Patrol officers had to herd the swelling crowd of jubilant couples away.

While waiting, Shelly Bailes and Ellen Pontac of Davis, who are among the couples whose marriages were annulled in 2004, stood on the steps and linked arms. Together for 34 years, they both had trouble sleeping in anticipation of Thursday.

“I’m not giving this back,” Pontac said of their newfound right to marry. “I’m keeping it.”

Hundreds of people also filled the steamy City Hall Rotunda, where the legal fight over gay marriage began in February 2004. Plaintiffs and other gay couples packed the grand staircase while dozens of others leaned over balconies on two upper floors. Some held each other, while others wiped their eyes along with their brows.

“Real people won,” Mayor Gavin Newsom told them.

The question now is whether the win will hold up. The Supreme Court ruling becomes final in mid-June, when gay couples will have the legal right to get marriage licenses at city halls from Eureka to San Diego.

But foes of same-sex marriage, following up on a vow to never allow the courts to have the last word, are moving to make sure the window for gay marriage will be closed quickly.

Groups aligned against gay marriage are on the brink of qualifying a ballot initiative for November that would amend the California constitution to confine marriage to a union between a man and a woman, a move that would effectively trump the Supreme Court’s ruling.

Glen Lavy, a lawyer with the conservative Alliance Defense Fund, said the ruling is fuel for the argument that California’s constitution needs to “protect marriage from being changed by the Legislature, the courts or anyone.”

With the prospect of thousands of gay couples marrying in the coming months, lawyers for the ballot backers are asking the Supreme Court to stay the ruling until after the November election. Legal experts doubt the justices will grant the request.

Gov. Arnold Schwarzenegger quickly signaled he will oppose the ballot initiative and any attempt to undercut the Supreme Court. But if the ballot initiative is approved, it could toss the state’s marriage laws back into the courts and once again cast doubt on same-sex wedding vows.

In the meantime, the most influential state Supreme Court in the nation, dominated by Republican appointees, has ruled in favor of gay rights advocates in the state with the largest gay population. The Massachussetts Supreme Court is the only other high court to permit same-sex marriage.

“It’s hard to see how what happened today in California stays in California,” said Marc Spindelman, an Ohio State University law professor and expert on same-sex marriage issues.

California was regarded by top gay rights lawyers as the “Gettysburg of the larger battle” over gay marriage, particularly with numerous courtroom setbacks in recent years in other states such as New York, Washington and New Jersey.

The Supreme Court’s decision established unprecedented new legal protections for gays. It concluded that the state’s domestic partners laws did not provide gay couples with the “equal dignity and respect” given to married heterosexual couples. George was joined in the majority decision by two other Republican justices, Kathryn Mickle Werdegar and Joyce Kennard. Justice Carlos Moreno, the court’s lone Democratic appointee, also joined George’s ruling.

The potential for political backlash for the justices who voted to overturn the gay marriage ban also exists, particularly for George, who wrote the opinion and is up for a retention election in just two years.

Legal experts say the generally conservative bent of the California Supreme Court could lend even more clout to the ruling.

“It’s very meaningful in the court of public opinion because it’s a moderate to conservative court,” said Jennifer Rothman, a Loyola University law professor following the case closely.

Three justices, Marvin Baxter, Ming Chin and Carol Corrigan, dissented from George’s ruling. Corrigan, however, did not seem completely opposed to gay marriage. She opened her dissent by stating: “In my view, Californians should allow our gay and lesbian neighbors to call their unions marriages.”

Corrigan, Baxter and Chin argued that it should be up to the voters or Legislature to sanction gay marriage, not the courts. A divided state appeals court reached that conclusion in 2006 when it upheld the ban on gay marriage. That ruling was overturned by the Thursday’s Supreme Court decision.

Baxter went so far as to say that the court overstepped its judicial powers by overturning existing marriage laws.

“There is no deeply rooted tradition of same-sex marriage, in the nation or in this state,” Baxter wrote. There is no constitutional right to gay marriage “because marriage is, as it always has been, the right of a woman and unrelated man to marry each other,” he added.

Newsom essentially invited the Supreme Court’s intervention when he ignited a national outcry by marrying same-sex couples at City Hall. The Supreme Court quickly halted Newsom’s edict, invalidating thousands of marriages. The justices found that Newsom had overstepped his authority by violating state law, but his action brought on a broad legal challenge to California’s ban on gay marriage.

San Francisco city officials, civil rights groups and gay couples then filed a series of lawsuits challenging a state family code section that restricts marriage to heterosexual couples. It also challenged a 2000 voter-approved ballot initiative, Proposition 22, that defines marriage as a union between a man and a woman.

California officials have defended the current law, despite the fact that both former Attorney General Bill Lockyer and current Attorney General Jerry Brown do not oppose gay marriage. State lawyers have argued that California’s strong domestic-partnership laws essentially already provide equal benefits to same-sex couples.

Conservative groups opposed to gay marriage have taken a stronger view, criticizing Lockyer and Brown for what they consider a tepid defense. They argue the state has a crucial interest in restricting marriage to heterosexual couples for social cohesion and because they maintain marriage is rooted in procreation.

The lawsuits argued that the state has been denying gay couples equal treatment. One of the leading cases to back their cause was another historic civil rights battle – a 60-year-old California Supreme Court ruling that struck down the state’s ban on interracial marriage. And indeed, George relied on that case in Thursday’s ruling.

"There is a general recognition that we don't need these military-style weapons in New Zealand, so it's very easy to win cross-party support for this," said Mark Mitchell, who was defense minister in the previous, center-right government and who supports the ban initiated by the center-left-led Labour Party.