A key senator announced his support for gay marriage legislation on Thursday, giving it enough votes to clear the upper chamber.

The declaration by Sen. James C. Rosapepe came shortly after a Senate committee approved an amended version of the Religious Freedom and Civil Marriage Protection Act, setting up a debate in the full Senate next week.

Senate President Thomas V. Mike Miller said the chamber could hold a final vote on the bill within the next 10 days.

If the narrow majority holds together through what is expected to be a contentious floor debate — and the possibility of amendments — the legislation would move to the House of Delegates, where supporters believe it would pass.

Gov. Martin O'Malley has said he would sign such a bill. Opponents could then petition for a referendum to overturn it, which would give voters the final say.

Passage would make Maryland the sixth state to recognize same-sex unions. Gay marriage is also legal in the District of Columbia.

Rosapepe, a Prince George's County Democrat, said in an e-mail to constituents that he intended to vote for the bill because it now contains greater protections for religious groups that don't want to participate in same-sex unions.

The contentious legislation gained momentum all week as undecided senators declared their support. Miller, who does not support gay marriage, predicted the Senate debate will be fierce, but he believes it will pass.

Miller said he wants "everyone to have their say" next week.

"When it appears people are repeating themselves, then we will take a cloture vote," he said. Senate rules require 29 votes to cut off debate and call an up-or-down vote. Advocates believe they have those votes.

Previous attempts to recognize same-sex marriage had never before made it out of the Judicial Proceedings Committee. But Democratic gains in November made the panel more amenable to the legislation.

"This is a historic piece of legislation," said committee Chairman Brian Frosh, a longtime supporter of gay marriage.

'I think it is a good thing if we encourage people to take care of each other."

The bill would repeal the definition of marriage as the union of a man and a woman. It would not force churches, synagogues or mosques to perform or celebrate gay weddings.

At a long and contentious hearing last week, opponents said the bill did not include adequate protections for groups affiliated with religious institutions that did not wish to support same-sex marriage. For example, they said, it would not shield the Knights of Columbus, a Catholic fraternal organization, from discrimination claims if it did not wish to rent out a hall for a gay wedding.

Rosapepe spent about an hour behind closed doors with Frosh and Sen. Jamie Raskin, both of whom sponsored the bill, before the committee meeting Thursday.

Raskin, a Montgomery County Democrat, had argued that further protections were unnecessary. But at the committee meeting, he proposed the amendment to more explicitly shield religious organizations, societies and nonprofits.

He said jokingly that the change could be called the "Raskin-Rosapepe amendment."

The influential Maryland Catholic Conference, the lobbying arm of the state's Catholic bishops in Annapolis, noted the change but restated its opposition.