BOSTON  The New Hampshire legislature approved revisions to a same-sex marriage bill on Wednesday, and Gov. John Lynch promptly signed the legislation, making the state the sixth to let gay couples wed.

The bill had been through several permutations to satisfy Mr. Lynch and certain legislators that it would not force religious organizations that oppose same-sex marriage to participate in ceremonies celebrating it. Some groups had feared they could be sued for refusing to allow same-sex weddings on their property.

Mr. Lynch, who previously supported civil unions but not marriage for same-sex couples, said in a statement that he had heard “compelling arguments that a separate system is not an equal system.”

“Today,” he said, “we are standing up for the liberties of same-sex couples by making clear that they will receive the same rights, responsibilities  and respect  under New Hampshire law.”