New Hampshire's governor signed a bill Wednesday making the state the sixth to allow same-sex marriages after legislators approved the measure earlier in the day.
John Lynch, the state's Democratic governor, had earlier promised a veto if the law didn't clearly spell out that churches and religious groups would not be forced to officiate at gay marriages or provide other services.
The state senate passed the measure Wednesday, and the house — where the outcome was more in doubt — followed later in the day. The house gallery erupted in cheers after the 198-176 vote.
New Hampshire's law takes effect Jan. 1. Massachusetts, Connecticut, Maine, Vermont and Iowa already allow gay marriage, though Maine opponents hope to overturn that state's law with a public vote.
California briefly allowed gay marriage before a public vote banned it; a court ruling grandfathered in couples who were married while it was legal.
"If you have no choice as to your sex, male or female; if you have no choice as to your colour; if you have no choice as to your sexual orientation; then you have to be protected and given the same opportunity for life, liberty and happiness," Republican Rep. Anthony DiFruscia said during the hour-long debate.
New Hampshire opponents, mainly Republicans, objected on grounds including the fragmented process that required three bills.
"It is no surprise that the legislature finally passed the last piece to the gay marriage bill today. After all, when you take twelve votes on five iterations of the same issue, you're bound to get it passed sooner or later," said Kevin Smith, executive director of gay marriage opponent Cornerstone Policy Research.
Lynch said he personally opposes gay marriage, but decided to view the issue "through a broader lens."
The revised bill added a sentence specifying that all religious organizations, associations or societies have exclusive control over their religious doctrines, policies, teachings and beliefs on marriage.
It also clarified that church-related organizations that serve charitable or educational purposes are exempt from having to provide insurance and other benefits to same sex spouses of employees.
The earlier version said "charitable and educational" instead of "charitable or educational."