BOSTON - After seven weeks of heated public debate and frantic backroom maneuvering, the Massachusetts Legislature approved yesterday a constitutional amendment banning gay marriage and establishing civil unions for same-sex couples.

Tense state lawmakers who gathered here for the third installment of a constitutional convention voted 105-92 to pass the measure.

Before it can become law, the amendment must again be approved by both houses of the Legislature in 2005. If that occurs, it will then be presented as a ballot initiative for the general populace. The earliest that vote could take place is November 2006.

The intent is to supersede a ruling by the state's highest court that said affording gays anything less than full marriage rights is unconstitutional. Despite the Legislature's action, the Supreme Judicial Court ruling will take effect May 17, making Massachusetts the first state to legalize same-sex marriage.

Yesterday's narrow vote reflected divisions within the Legislature, whose members agonized in marathon sessions over whether to change the nation's oldest constitution. And when it was all over, few on either side of the debate were celebrating.

Arline Isaacson, co-chairwoman of the Massachusetts Gay and Lesbian Political Council, called the Legislature's action "very disappointing," because her organization had hoped that no amendment would be passed, allowing the court decision to take effect unchallenged.

"I believe many of them are going to feel very ashamed of what they've just done today," Isaacson said.

The response from opponents of same-sex marriage was subdued. Ron Crews, president of the Massachusetts Family Institute, called the vote "a meager win, in that the definition of marriage is still preserved as the union of one man and one woman."

Crews, who as a Republican legislator in Georgia wrote that state's defense of marriage law, said yesterday's action set the stage for Republican Gov. Mitt Romney "to take a stand to delay the implementation of gay marriage on May 17."

At a news conference immediately after the vote, Romney said that by adopting the amendment, the Legislature had created "a conflict" with the Supreme Judicial Court.

"Given this conflict, I believe the Supreme Judicial Court should delay the imposition of its decision until the people have a chance to be heard," said the governor, an outspoken opponent of same-sex marriage. Romney vowed to seek an immediate stay of the court's decision.

But Attorney General Tom Reilly - who represents the state in court and who had pledged earlier to support the Supreme Judicial Court decision that legalized gay marriage - quickly rebuffed the governor, saying he would not seek to delay the May 17 deadline on Romney's behalf. Without court intervention, yesterday's vote in the Legislature will not affect the deadline.

The high court's ruling opened the floodgates for supporters of gay and lesbian marriage nationwide, with same-sex unions being performed in California, Oregon, New York, New Jersey and New Mexico.

An amendment would make Massachusetts the second state to provide a marriage-like alternative for gay and lesbian couples. The Vermont Legislature coined the term "civil union" in 2000 when it passed the country's first law guaranteeing the rights and benefits of marriage for same-sex couples.

The Los Angeles Times is a Tribune Publishing newspaper.