When Massachusetts became the first state to legalize same-sex marriage in November 2003, gay rights advocates imagined a chain reaction that would shake marriage laws until same-sex couples across the nation had the right to wed.

Nowhere did same-sex marriage seem more like a natural fit than in New York, where the Stonewall uprising once inspired the gay rights movement and where a history of spirited progressivism had led some gay couples to envision their own weddings someday.

Thursday's 4-2 ruling against same-sex marriage by New York's highest court was more than a legal rebuke. The New York Court of Appeals sidestepped the question of whether same-sex marriage is worthwhile. "It is not for us to say whether same-sex marriage is right or wrong," the court wrote, saying that persuasive arguments exist on both sides.

Instead, the court focused on whether the state Legislature had a rational, nondiscriminatory basis for limiting marriage to a man and a woman. The judges concluded that legislators could reasonably believe that such marriages benefited children. Unlike racism, the judges concluded, "the traditional definition of marriage is not merely a by-product of historical injustice."

Gay rights leaders said they were stunned both by the rejection and by the decision's language, which appeared to elevate the children of heterosexual couples over the children of gay couples and to suggest that homosexuality was a preference instead of an orientation.

"I never would have dreamed that New York's highest court would be so callous and insulting to gay people -- not in New York -- to have a legal decision that treats us as if we are alien beings," said Matt Foreman, executive director of the National Gay and Lesbian Task Force, a gay rights group.

Opponents of same-sex marriage were exhilarated by the decision and its language, predicting that it foreshadowed legal defeats for same-sex marriage in other states.

The New York ruling came on the same day as another setback in Georgia, where that state's highest court reinstated a ban on same-sex marriage that was approved in a statewide referendum in 2004 but had been overturned by a lower court.

It was not supposed to turn out this way for the gay rights activists who saw hopeful tidings nearly three years ago in the Massachusetts ruling and who did not believe that a stinging new defeat could happen in New York.

"The New York Court of Appeals has a long tradition of protecting equal rights for New Yorkers, but today the court let us down," said Christine Quinn, the first openly gay speaker of the New York City Council.

Before the decision in New York, some gay leaders predicted that it would take only a decade for several states to legalize same-sex marriage and for the U.S. Supreme Court to set a single custom of civil marriage for all states by allowing gays to wed everywhere. On Thursday, some of those activists said they were dispirited enough to wonder if it would take two decades or more to reach that goal.

"New York just reminded us that we'll have to go through a long period of conflict and confusion before we make it to the other side," said Shannon Minter, legal director of the National Center for Lesbian Rights.

At the same time, Minter downplayed the significance of the New York ruling for California's same-sex marriage case, which will be argued Monday in the state Court of Appeal in San Francisco. Minter's organization represents 12 same-sex couples challenging the California law, which defines marriage as the union of a man and a woman.

"Unlike New York, the California Legislature and California courts have taken a strong stand that lesbian and gay parents and their children need and deserve equal legal protections," Minter said. He cited California's domestic partners law, state Supreme Court rulings last year upholding equal parental rights for lesbians and the Legislature's passage of a same-sex marriage bill that Gov. Arnold Schwarzenegger vetoed.

"Because of this clear policy, a California court could not accept a desire to treat some families as superior to others as a legitimate basis for discrimination in marriage," Minter said.

Both sides in the debate agreed that the legal analysis in the New York decision would be read by, and perhaps influence, judges in other states who are considering similar cases. A ruling in a New Jersey case is expected by August, and another decision is forthcoming in the state of Washington.

Opponents of same-sex marriage immediately hailed the New York decision as a sign that the legal and political campaign in support of same-sex marriage nationwide had stalled. More than 40 states have laws that restrict marriage to a man and woman, and no high court or state legislature has granted a right to marry anywhere except Massachusetts.

Monte Stewart, president of the Marriage Law Foundation, said he took particular pleasure in the "superb and straightforward legal analysis" of the New York decision. He argued that it would provide a foundation for jurists in other states to similarly restrict civil marriage to a man and a woman.

Specifically, Stewart hailed Judge Robert Smith for refusing to use the racist legacy of miscegenation laws as a justification for extending marriage rights to same-sex couples. Too often, Stewart said, trial court judges and politicians are cowed into allowing gays to marry on the premise that barring their unions would be the same as barring people of different races to marry.

David Buckel, senior counsel and director of the Marriage Project at the Lambda Legal Defense and Education Fund, which is pursuing court cases to legalize same-sex marriage, acknowledged that the New York decision "will certainly be an opinion that other states will look at."

Yet Buckel and other supporters of same-sex marriage said that parts of the ruling could shock judges and other Americans into seeing same-sex marriage in a favorable light. In particular, they noted one section that suggested heterosexual couples need marriage to be preserved for them as a way to shore up their faulty relationships and protect their children, who might suffer in broken-home situations.

"It's a mess of a decision that in the end makes a very weak argument: That you can justify barring same-sex couples from marrying because of the unstable relationships of heterosexual couples," Buckel said.

With the New York case out of the way, the New Jersey case is taking on prominence, given that some legal analysts say that state's highest court has a history as an assertive force for social change. Seven longtime couples sued in 2002 for the right to marry; five of the couples have children.

Joe Solmonese, the president of the Human Rights Campaign, a national gay rights group, said that he was surprised that the New York decision connected the rights and responsibilities of marriage to childbearing, as if gay couples did not have children.

"If nothing else, this ruling will cause people -- gay and straight alike -- to reflect on this judge's unusual view of gay marriage and then come to their own conclusions," Solmonese said.