Sen. Joseph Getty, R-Carroll, listens to a debate on a gay marriage bill in Annapolis, Md., Thursday, Feb. 23, 2012. The Senate approved the bill, and Gov. Martin O'Malley is expected to sign it next week.

Sen. Joseph Getty, R-Carroll, listens to a debate on a gay marriage bill in Annapolis, Md., Thursday, Feb. 23, 2012. The Senate approved the bill, and Gov. Martin O'Malley is expected to sign it next week.

Photo: Patrick Semansky, Associated Press

Image 3 of 9

Sen. Delores Goodwin Kelley, D-Baltimore County, center, speaks during a debate on a gay marriage bill in Annapolis, Md., Thursday, Feb. 23, 2012. The Senate approved the bill, and Gov. Martin O'Malley is expected to sign it next week. less

Sen. Delores Goodwin Kelley, D-Baltimore County, center, speaks during a debate on a gay marriage bill in Annapolis, Md., Thursday, Feb. 23, 2012. The Senate approved the bill, and Gov. Martin O'Malley is ... more

Judy Gaver, left, and June Horner, mothers of openly gay sons who reside in Maryland, speak with Maryland Gov. Martin O'Malley in Annapolis, Md., Thursday, Feb. 23, 2012, after the Senate approved a gay ... more

Photo: Patrick Semansky, Associated Press

Image 5 of 9

Image 6 of 9

Maryland Senate President Thomas V. "Mike" Miller, standing at top center, oversees activity in the Senate chambers in Annapolis, Md., Thursday, Feb. 23, 2012, where the Senate is expected to vote on a gay marriage bill Thursday. less

Maryland Senate President Thomas V. "Mike" Miller, standing at top center, oversees activity in the Senate chambers in Annapolis, Md., Thursday, Feb. 23, 2012, where the Senate is expected to vote on a gay ... more

Photo: Patrick Semansky, Associated Press

Image 7 of 9

Sen. Edward Reilly, R-Anne Arundel, speaks in opposition of a gay marriage bill on the state Senate floor in Annapolis, Md., Thursday, Feb. 23, 2012. The Senate approved the bill, and Gov. Martin O'Malley is expected to sign it next week. less

Sen. Edward Reilly, R-Anne Arundel, speaks in opposition of a gay marriage bill on the state Senate floor in Annapolis, Md., Thursday, Feb. 23, 2012. The Senate approved the bill, and Gov. Martin O'Malley is ... more

Photo: Patrick Semansky, Associated Press

Image 8 of 9

Maryland Gov. Martin O'Malley, left, embraces Sen. Richard Madaleno, D-Montgomery, an openly gay member of the state Senate, in Annapolis, Md., Thursday, Feb. 23, 2012, after the Senate approved a gay marriage bill. Gay marriage is all but legalized in Maryland with the legislature giving its final OK to the law that is awaiting the expected signature of the governor. less

Gay marriage is all but legal in Maryland after the Legislature gave its final OK Thursday to the law that's being sent to Gov. Martin O'Malley, who said he expects to sign it this week.

The state Senate voted 25-22 for the law. The vote comes less than a week after the House of Delegates barely passed the measure.

Maryland will become the eighth state to allow gay marriage when O'Malley - who sponsored the bill - signs the legislation. The Democrat made the measure a priority this session after it stalled last year.

"This issue has taken a lot of energy, as well it should, and I'm very proud of the House of Delegates and also the Senate for resolving this issue on the side of human dignity, and I look forward to signing the bill," O'Malley said in a brief interview after the Senate vote.

Opponents, though, have vowed to bring the measure to referendum in November. They will need to gather at least 55,726 valid signatures of Maryland voters to put it on the ballot and can begin collecting names now that the bill has passed both chambers.

President Trump addresses nation after mass shooting at Florida SchoolWhite House

Some churches and clergy members have spoken out against the bill, saying it threatens religious freedoms and violates their tradition of defining marriage as between a man and a woman.

"The enormous public outcry that this legislation has generated - voiced by Marylanders that span political, racial, social and religious backgrounds - demonstrates a clear need to take this issue to a vote of the people," Maryland Catholic Conference spokeswoman Kathy Dempsey said in a statement. "Every time this issue has been brought to a statewide vote, the people have upheld traditional marriage."

Leaders at the Human Rights Campaign, a group that joined a coalition of organizations to campaign for the bill, said they expect opponents will gather the required number of signatures.

"There remains a lot of work to do between now and November to make marriage equality a reality in Maryland," Joe Solmonese, the group's president, said in a statement Thursday. "Along with coalition partners, we look forward to educating and engaging voters about what this bill does: It strengthens all Maryland families and protects religious liberty."

Senators rejected some amendments to the legislation Thursday. Proponents warned that amending the bill could kill it because gathering enough support for altered legislation in the House would be difficult.

Last year, senators passed a similar measure by 25-21, but the bill died in the House after delegates rescinded their initial support citing concerns that it could violate religious liberties of churches and business owners who do not support same-sex unions.

Sen. Allan Kittleman, the only Senate Republican to vote in favor of the legislation, said he is proud of his decision and not concerned about political consequences down the road.

"You don't worry about politics when you're dealing with the civil rights issue of your generation," said Kittleman, a Republican who is the son of the late Sen. Robert Kittleman, who was known for civil rights advocacy.