(CNN) -- Lawmakers voted in favor of same-sex marriage in New Hampshire and Maine on Wednesday, leaving Rhode Island as the only other New England state without legislation in favor of the issue.

Maine Gov. John Baldacci signed a bill Wednesday legalizing same-sex marriage.

Maine Gov. John Baldacci signed his state's same-sex marriage bill less than an hour after the legislature approved it.

"I have come to believe that this is a question of fairness and of equal protection under the law, and that a civil union is not equal to civil marriage," Baldacci, a Democrat, said in a statement released as he signed the bill.

But he raised the possibility that the citizens of the state would overturn the law, saying: "Just as the Maine Constitution demands that all people are treated equally under the law, it also guarantees that the ultimate political power in the state belongs to the people."

It was not immediately clear whether New Hampshire Gov. John Lynch, a Democrat who has questioned the need for such legislation, would sign the bill passed Wednesday by the legislature in his state. Lynch said last week he did not think the law is necessary because the state already recognizes civil unions.

If he does sign, his state will join New England neighbors Maine, Vermont, Connecticut and Massachusetts, which all have laws approving same-sex marriages. That would leave Rhode Island, which has same-sex marriage bills pending in its general assembly.

Iowa is the only other state that allows same-sex marriages, after the Iowa state Supreme Court ruled unanimously on April 3 that it is illegal to discriminate against same-sex couples by denying them the right to marry. The first gay marriages in the state took place April 27.

California's state Supreme Court issued a similar ruling in May 2008, after which some 18,000 gay and lesbian couples got married there. But California voters in November approved Proposition 8, which amended the state constitution to ban gay marriage. See which states allow same-sex unions »

The state's high court heard arguments earlier this year about whether Proposition 8 was itself constitutional, but it has not yet issued a verdict.

New York Gov. David Paterson introduced legislation in April to make same-sex marriage legal in his state. A similar bill died in the state Senate in 2007.

The District of Columbia voted Tuesday to recognize same-sex marriages performed elsewhere, but does not itself give marriage licenses to gay or lesbian couples.

In New Hampshire, the House voted 178-167 in favor of the legislation Wednesday after the Senate approved an amended version of the House's original bill last week. The amended version distinguishes between civil and religious marriage. It allows each religion to decide whether to acknowledge same-sex marriage, but extends the option of civil marriage to any two individuals.

Meanwhile, the Human Rights Campaign, a gay and lesbian rights organization, praised Maine's new law.

"This law is simply about making sure that loving, committed couples, and their families, receive equal rights and responsibilities. This is a step that will strengthen Maine families," Human Rights Campaign President Joe Solmonese said in a written statement.

A slim majority of Americans are against legal recognition for same-sex marriage, CNN polling found last month. Fifty-four percent of adults questioned in an April 23-26 nationwide CNN/Opinion Research Corporation poll said marriages between gay or lesbian couples should not be recognized as valid, while 44 percent said they should be considered legal.

But there was a huge gap between the opinions of younger and older people, with younger people far more likely to approve of gay marriage.

Nearly 6 in 10 people ages 18 to 34 said same-sex marriages should be legal. Just over 4 in 10 people ages 35 to 49 agreed. Numbers were similar for 50- to 64-year olds, while only 24 percent of people 65 and older agreed.

The survey's sampling error was plus or minus 3 percentage points.

All About Maine • Same-Sex Marriage