“We are upset, we are disappointed, but we aren’t done fighting,” said Leslie Gabel-Brett, Lambda’s director of education and public affairs.

Image The Senate gallery just before the final vote, a nay, was cast to defeat the gay marriage bill, 20 to 14. Supporters vowed a battle in State Supreme Court. Credit... Richard Perry/The New York Times

Opponents of gay marriage said that they, too, were prepared for a legal fight. Jon Tomicki, a leader of the New Jersey Coalition to Preserve and Protect Marriage, said that legislators had already complied with the court order by enacting civil unions, and urged lawmakers to let the public cast its verdict on gay marriage in a referendum.

“In 30 other states, voters have gotten the chance to decide,” Mr. Tomicki said. “There’s no reason why New Jerseyans shouldn’t have the same right.” In nearly every instance in which gay marriage has been put up for a referendum, it has been defeated.

But supporters of gay marriage view their cause as a matter of civil rights which should be settled by the courts and Legislature, and point out that in 1915, New Jersey voters in a referendum rejected giving women the right to vote. Five years later, the 19th Amendment granted women voting rights.

Although it was not a major issue in the governor’s race, the effort to win legislative approval of same-sex marriage is widely viewed as a casualty of Mr. Corzine’s defeat in November. Some Democrats who had been receptive to the issue, and took financial and organizational support from gay activists, grew squeamish.

Senator Stephen M. Sweeney, who is scheduled to become Senate president this month, said he thought voters would look unkindly on the Legislature if it pushed for a social issue at a time of economic suffering. Senator Sweeney did not cast a vote on the measure on Thursday. In all, five senators did not vote and one was too ill to attend.

Senator Gerald Cardinale, a Republican from Cresskill, said during the debate on the Senate floor on Thursday that the results of the governor’s race were a clear indication that voters opposed gay marriage. Senator Cardinale said that although the civil unions statute was flawed, the state would be doing “violence” to the institution of marriage by changing its current definition as a union between one man and one woman.