A judge declared Friday that a law banning same-sex marriage (search) violates the state constitution, a first-of-its-kind ruling in New York that would clear the way for gay couples to wed if it survives on appeal.

State Supreme Court Justice Doris Ling-Cohan (search) ruled in favor of five gay couples who had been denied marriage licenses by New York City. The Supreme Court is New York's trial level court.

The couples brought a lawsuit arguing they were denied legal protections guaranteed under the constitution. The judge agreed and said the New York City clerk may not deny a license to any couple solely because the two are of the same sex.

"Under both the federal and New York State constitutions, it is beyond question that the right to liberty" extends to protect marriage," Ling-Cohan wrote.

The ruling will not take effect for at least 30 days. The city Law Department issued a statement saying only, "We are reviewing the decision thoroughly and considering our options."

Gay rights activists hailed the ruling as a historic victory that "delivers the state constitution's promise of equality to all New Yorkers."

"The court recognized that unless gay people can marry, they are not being treated equally under the law," said Susan Sommer, a Lambda Legal Defense Fund (search) lawyer who presented the case. "Same-sex couples need the protections and security marriage provides, and this ruling says they're entitled to get them the same way straight couples do."

Mathew Staver, president of Liberty Counsel (search), said he was "disappointed" by the decision. "Redefinition of a law's terms is for the legislature to do, not for a judge. She's an activist judge legislating from the bench."

The judge ordered a copy of her decision sent to the state attorney general, who was not involved in the case. Calls to Attorney General Eliot Spitzer's (search) office were not immediately returned.

Kevin Quinn, spokesman for Republican Gov. George Pataki (search), said, "The governor strongly believes that the judge's decision is wrong," adding that "New York's marriage laws are clear that marriage is between a man and a woman."

The ruling applies only in the city, but could extend statewide if upheld by the Court of Appeals in Albany.

Mary Jo Kennedy and Jo-Ann Shain, one of the couples in the case, said they were thrilled by the ruling and believed it would offer their family increased legal protection. They have been together 23 years and have a 15-year-old daughter.

"We're just overjoyed," said Shain. "We didn't think it would ever happen.

Kennedy said she wants to marry Shain as soon as possible. "I can't wait," she said. "We went to buy a (marriage) license in March 2004 and couldn't get it. That's what started this whole thing."

The judge noted that one plaintiff in the case, Curtis Woolbright, is the son of an interracial couple who moved to California in 1966 to marry. She said California then was the only state whose courts had ruled that interracial marriage prohibitions were unconstitutional.