Under pressure from New Jersey's highest court to offer marriage or its equivalent to gay couples, the Legislature voted Thursday to make New Jersey the third U.S. state to allow civil unions.

Democratic Gov. Jon Corzine said he would sign the measure, which would extend to same-sex couples all the rights and privileges available under state law to married people. The bill passed the Assembly 56-19 and the Senate 23-12.

"Love counts," Democratic Assemblyman Wilfredo Caraballo, a chief sponsor of the bill, said as the debate opened. "The gender of whom one loves should not matter to the state."

But Republican Assemblyman Ronald S. Dancer said: "It's my personal belief, faith and religious practice that marriage has been defined in the Bible. And this is one time that I cannot compromise my personal beliefs and faiths."

Massachusetts is the only state to allow gay marriage. Vermont and Connecticut have civil unions, and California has domestic partnerships that work similarly.

Among the benefits gay couples would get under New Jersey's civil unions bill are adoption rights, hospital visitation rights and inheritance rights.

Gay rights advocates welcomed the legislation as a step forward but said they would continue to push for the right to marry.

The bill was drafted in response to a landmark New Jersey Supreme Court ruling in October that required the state to extend the rights and benefits of marriage to gay couples within 180 days. The court, in its 4-3 ruling, left it up to the Legislature to decide whether to call such unions "marriages" or something else.

Gay rights groups have argued that not calling such unions "marriage" creates a different, and inferior, institution.

Steven Goldstein, director of the gay rights advocacy organization Garden State Equality, said he expects gay couples to be able to get married in New Jersey within two years.