AUGUSTA, Maine — In a banner day in New England for advocates of gay marriage, Maine legalized the practice Wednesday, and the New Hampshire Legislature voted to do the same.

Maine Gov. John Baldacci, a Democrat, signed LD 1020 shortly after the legislation passed the Senate with a 21-13 vote — a margin not large enough to override a veto.

“In the past, I opposed gay marriage while supporting the idea of civil unions,” Baldacci said in a statement read in his office. “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.”

If New Hampshire Gov. John Lynch signs his state’s bill or lets it become law without his signature, New Hampshire would become the sixth overall to allow gay marriage and the fifth in New England. Rhode Island would be the region’s only holdout.

The Maine bill authorizes marriage between any two people rather than between one man and one woman, as state law currently allows. The Maine House had passed the bill Tuesday.

Both states’ bills specify that religious institutions are not compelled to recognize same-sex marriages.

The Maine law is to take effect in mid-September but could be sidetracked before then. Opponents promise to challenge it through a public veto process that could suspend the law while a statewide vote takes shape.

Sue Estler of Orono said she and her partner of 20 years, Paula Johnson, plan to get married. But she also thinks opponents might collect enough signatures to force the referendum.

A professor at the University of Maine, the 64-year-old Estler said she sent an e-mail to out-of-state friends and family members Wednesday saying, “Oh, my god. The governor just signed the bill.”

“But I said, ‘Don’t make your travel plans for the wedding yet. There’s still probably a referendum to go,”’ she said.

Legislative debate was brief. Senate President Elizabeth Mitchell, D-Vassalboro, turned the gavel over to an openly gay member, Sen. Lawrence Bliss, D-South Portland, to preside over the final vote.

Republican Sen. Debra Plowman of Hampden argued that the bill was being passed “at the expense of the people of faith.”

“You are making a decision that is not well-founded,” warned Plowman.

If the issue of gay marriage comes to a statewide vote in Maine, supporters are confident they will prevail.

David Weeda, 50, of Bucksport moved to Maine with his partner, Dominick Rizzo, in 2003. Weeda said the prospect of a referendum would not dampen his enthusiasm about the approval of gay marriage in Maine.

“We hope that Maine people will have the wisdom, courage and compassion to keep this law on the books,” he said.

The activist group Gay & Lesbian Advocates & Defenders has targeted all six New England states for passage of a gay marriage law by 2012.

Maine is now the fourth state in the region to allow same-sex marriages. Connecticut enacted a bill after being ordered to allow gay marriages by the courts, and Vermont passed a bill over the governor’s veto.

Massachusetts’ high court has ordered the state to recognize gay marriages. In Rhode Island, a bill to legalize same-sex marriage has been introduced but is not expected to pass this year.

BDN writer Judy Harrison contributed to this report.