The Maryland Senate narrowly approved legislation Thursday that would legalize same-sex marriages after a day of emotional and often personal debate laced with references to religion and civil rights.

The 25 to 21 vote sent the bill to the House of Delegates, traditionally the more liberal chamber on social issues. But supporters acknowledged Thursday that they still were a couple of votes shy of the majority needed for House passage.

During Senate debate, supporters called the legislation a matter of fairness, arguing that same-sex couples should be entitled to the hundreds of rights conferred by the state on other married couples.

Several of his colleagues countered that marriage should be reserved for couples who can procreate and urged the Senate not to broaden its definition.

"The Senate has become the last bastion to protect the sacred institution of traditional marriage," said Sen. Bryan W. Simonaire (R-Anne Arundel). He warned that "young, impressionable students" would be taught "the homosexual worldview" if the bill passed.

Maryland would join five other states and the District in allowing same-sex couples to marry. Gov. Martin O'Malley (D) has said he will sign the legislation if it reaches his desk.

With attention turning to the House, supporters acknowledged Thursday that same-sex marriage has been a hard sell in that chamber with African American lawmakers from Prince George's County, as well as conservative Democrats from Southern Maryland and the Baltimore suburbs.

"We can take nothing for granted in the House," said Del. Heather R. Mizeur (D-Montgomery), who is openly gay and has been among those counting votes. "We still stand a few votes short of where we need to be to assure victory."

The Maryland Catholic Conference has lobbied against the same-sex marriage bill. During Thursday's Senate debate, some of the most vocal opposition to expanding the definition of marriage came from those with a tradition in Maryland's black churches.

"Here's my question: Where does it stop?" asked Sen. C. Anthony Muse (D-Prince George's), who is also senior pastor at the Ark of Safety Christian Church of Upper Marlboro. He questioned whether polygamy or marriage between people of very different ages would one day be acceptable.

Sen. Joanne C. Benson (D-Prince George's) said she grew up watching her father - whom she described as "a civil rights warrior" - conduct marriages and came to believe such unions should be reserved for people who can have children.

"Two people of the same sex cannot produce children," she said.

Several other senators argued that extending marriage rights to gay couples is a matter of civil rights.

Four senators whose districts include part of Prince George's opposed the bill, including Senate President Thomas V. Mike Miller Jr. (D-Calvert). Also voting in opposition: Ulysses Currie, Muse and Douglas J.J. Peters. Benson, who had previously announced her opposition to the bill, was absent for the final vote.

The Senate debated the bill for about 90 minutes Thursday morning and then resumed discussion late in the afternoon.

About 6 p.m., senators voted 30 to 17 to limit debate to another hour, a move that ensured there would be no filibuster before final passage.

The legislature might not get the final word on same-sex marriage. If the bill passes, opponents say they will try to take advantage of a Maryland law that allows residents to petition just-passed laws for a statewide vote. The measure would appear on the November 2012 ballot if enough signatures were collected.

Miller predicted that the petition effort would be successful and that the law could be overturned.