TRENTON — A state judge today ruled to legalize same-sex marriage in New Jersey, saying gay couples would be denied federal benefits if the state kept allowing only civil unions.

Superior Court Judge Mary Jacobson granted an emergency request by six gay couples, ordering state officials to begin officiating same-sex marriages on Oct. 21.

"Same-sex couples must be allowed to marry in order to obtain equal protection of the law under the New Jersey constitution," the judge wrote in a 53-page opinion.

But Gov. Chris Christie, who opposes gay marriage, vowed today to appeal the ruling all the way to the state Supreme Court.

"Governor Christie has always maintained that he would abide by the will of the voters on the issue of marriage equality and called for it to be on the ballot this Election Day," said Christie spokesman Michael Drewniak. "Since the Legislature refused to allow the people to decide expeditiously, we will let the Supreme Court make this constitutional determination.”

SEE THE COMPLETE RULING BELOW

The case could take months to reach New Jersey's highest court. The governor's office did not say whether it would seek to freeze Jacobson's order while the appeal is pending.

In the meantime, gay rights advocates reacted with joy, celebrating a "historic day" that brings New Jersey in line with nearby states including Connecticut, Maryland and New York.

"It's a wonderful victory," said Lawrence Lustberg, an attorney for the six couples and the group Garden State Equality. "New Jersey has always been on the forefront of protecting constitutional rights. This decision keeps us in that tradition."

Hayley Gorenberg, another attorney for the couples from the group Lambda Legal, called it "a resounding and satisfying and well deserved victory for our clients."

"It means so much to my clients and their couples and their children and their families throughout the state," she said. "They've fought long and hard to be able to protect the people they love most without discrimination."

Christie's administration had argued that the matter was out of New Jersey's hands since the only pressing questions were over federal, not state, benefits.

Garden State Equality and Lambda Legal had argued that after the U.S. Supreme Court extended more than 1,000 tax and inheritance benefits to same-sex couples in June, New Jersey was left behind with "second-class" civil unions that could not reap those legal boons and protections.

Jacobson, the head judge in Mercer County, agreed.

"The ineligibility of same-sex couples for federal benefits is currently harming same-sex couples in New Jersey in a wide range of contexts," she wrote.

For example, the judge said, "civil union partners who are federal employees living in New Jersey are ineligible for marital rights with regard to the federal pension system, all civil union partners who are employees working for businesses to which the Family and Medical Leave Act applies may not rely on its statutory protections for spouses, and civil union couples may not access the federal tax benefits that married couples enjoy."

Advocacy groups and Democratic state officials reacted quickly, cheering Jacobson's decision and urging Christie to let it stand unchallenged. And vowing to fight it if Christie did appeal.

“We have been saying it for months and