, N.H. (AP) — New Hampshire's governor has signed legislation making the state the sixth to allow gay marriage.

Gov. John Lynch was surrounded by cheering supporters as he signed the three bills about an hour after the key vote Wednesday in the House of Representatives.

The law will take effect in January, exactly two years after the state legalized civil unions.

New Hampshire joins Massachusetts, Connecticut, Maine, Vermont and Iowa in recognizing same-sex marriages, though opponents hope to overturn Maine's law with a public vote.

Lynch demanded language protecting the rights of religious opponents of gay marriage before signing the bills.