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.

“It provides full equality under the law for . . . couples like Mark and myself,” said Sen. Richard S. Madaleno Jr. (D-Montgomery), who is openly gay, referring to his partner of more than a decade, with whom he has two young children.

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.”

House Majority Leader Kumar P. Barve (D-Montgomery), the lead sponsor of the legislation in his chamber, said he remains “confident but not overconfident” that the bill will pass.

A hearing is scheduled Friday on the bill in the House, where 71 votes are needed for passage in the 141-member chamber.

House Speaker Michael E. Busch (D-Anne Arundel) said in an interview this week that he intends to vote for the bill despite his preference that the state grant civil unions to gay couples as an alternative to marriage.

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.

“I do think history will show this as a proud day,” said Sen. Delores G. Kelley (D-Baltimore County), who noted that she has been married for 54 years to a man whom she called her “high school sweetheart.”

“I cannot say what is right for others,” Kelley said. “I am not the monitor of people’s lives.”

Sen. Ronald N. Young (D-Frederick) said he considered the same-sex marriage legislation “simply fair and right.”

“If I lose an election over this vote, so what?” he said. “It’s right. Sometimes you have to do what’s right.”

Only one of the chamber’s 12 Republicans, Sen. Allan H. Kittleman (Howard), voted for the bill Thursday. Eleven Democrats joined 11 Republicans in opposing it.

All eight senators from Montgomery County supported the bill, including its lead sponsor, Sen. Robert J. Garagiola (D).

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 three Prince George’s senators who supported the bill were Sen. Paul G. Pinsky, Sen. Victor R. Ramirez and Sen. James C. Rosapepe.

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.