The storylines were similar: A divided state legislature grapples with the emotional question of whether to allow same-sex couples to marry.
But several plot twists — an ambitious Democratic governor as the main character, a multimillion-dollar outreach effort and the involvement of key Republicans — led New York to a different final scene than in Maryland.
Same-sex marriage activists in Maryland said Monday that they are studying the success of their counterparts in New York, which over the weekend became the sixth state to allow gay couples to marry.
The Marylanders, whose own efforts fell short during the 2011 legislative session, say they are planning to adopt some of New Yorkers' tactics when they try again next year.
"New York proves this can happen," said Del. Keiffer Mitchell, a Baltimore Democrat who championed the Maryland bill in the House of Delegates. "I was watching that pass and dreaming, because it should have been us."
Opponents, meanwhile, predicted New York would have no impact on the debate here.
"Everybody across the country was shocked that Maryland did not legalize same-sex marriage," said Del. Don H. Dwyer Jr., one of the legislation's most vocal opponents.
"But our Republicans stood strong and are going to stay strong, whereas in New York, they didn't have the guts to stand up and do what's right," the Anne Arundel County Republican said.
"Plus," Dwyer added, "Democrats remain afraid of retribution at the polls if they vote for same-sex marriage. That's not going to change."
On the top of the advocates' to-do list: Get the governor out front.
Both New York and Maryland are led by Democrats with national political ambitions.
New York Gov. Andrew M. Cuomo, who campaigned last year on legalizing same-sex marriage, made it a key priority to get a bill to his desk in the first year of his term.
Democratic state Sen. Richard S. Madaleno Jr. of Montgomery County, the Senate's only openly gay member, said he has asked O'Malley to sponsor a gay marriage bill next year in every conversation they've had during the past four months.
"I think people from around the state and the country are going to come to Martin O'Malley and say, 'You should be doing what Andrew Cuomo did because it's the right thing to do and it's smart politics,'" Madaleno said.
Patrick Wojahn, chairman of the board of directors of Equality Maryland, the state's leading lobbying group for gay rights, said the governor "could make it more of a priority."
"While Governor O'Malley has certainly been an ally, and we certainly appreciate his work, it's clear that Governor Cuomo really went to bat for this issue and made it a top priority," Wojahn said. "I know he stands with us. He is on our side, but I think that he could make it more of a priority."
O'Malley said his decision to work behind the scenes, rather than pushing the bill as Cuomo did, was strategic.
"If I thought [making gay marriage part of his administration's legislative agenda] would have helped rather than hurt its chance of passage, I'd have done it," O'Malley said Monday.
But he concluded that higher visibility, he said, "would have kicked it into the gutter of partisan division."
Instead, O'Malley made phone calls as requested by the bill's advocates, said his top legislative aide, Joseph C. Bryce. As the Senate vote neared, O'Malley called a half-dozen Democrats thought to be on the fence. After the Senate passed the bill, sending it to the House, his call list expanded to about a dozen delegates, Bryce said.
Ultimately, House Democratic leaders sent the legislation back to committee in late February, effectively shelving it for the duration of the 90-day session. Leaders believe it was about three votes short of a majority.
Marc Solomon, the national campaign director of New York-based Freedom to Marry, spent the past two weeks in Albany. He said Monday that Cuomo's leadership on gay marriage "was completely instrumental."
"He not only picked this issue up, he drove it," Solomon said. "The rest of the work came out of that effort."
After New York's Republican-controlled Senate approved the legislation Friday, Freedom to Marry said in a release that "no governor has ever worked harder or more strategically [than Cuomo] to advance marriage legislation."
Cuomo signed the bill on Saturday, effectively doubling the number of Americans who live in states that allow gay couples to marry. Now six states plus the District of Columbia have approved gay marriage.
Asked whether he would put his name on a same-sex marriage bill next year, O'Malley said, "we'll certainly be looking very seriously at that as we put together our legislative agenda."
The language of the Maryland and New York bills was similar. Both offered protections for religious groups that do not condone gay marriage.
One major difference between the states: New York does not allow voters to petition new laws to referendum.
If same-sex marriage legislation is approved in Maryland next year, advocates believe the state's referendum process could prove a second — and costly — challenge.
Emily Hecht-McGowan, director of public policy for the Boston-based Family Equality Council, said the "massive public education campaign" in New York by a coalition of same-sex marriage advocacy groups that spent $2 million or more was critical in winning over legislators.
"It really made a difference to get families' stories told publicly," Hecht-McGowan said. "Hearing from constituents why marriage matters won people over. It was a well-coordinated effort across LGBT and civil rights groups."
Equality Maryland said it spent about $250,000 during the legislative session, while other groups contributed smaller amounts to the cause.
Advocates say that New York shows there are Republicans who support same-sex marriage — something supportive lawmakers here said they might try to leverage.
In Maryland, Sen. Allan Kittleman was the only one of 55 GOP lawmakers to support the legislation. His stance on gay marriage as a civil rights issue so rankled fellow Senate Republicans that he resigned his position as minority leader.
In the House of Delegates, the Republicans' decision to vote as a bloc against same-sex marriage helped doom the bill on the floor.
New York, by contrast, passed gay marriage out of a Republican-led Senate after advocates won over a crucial four GOP senators. They pushed the final vote total to 33-29.
Kittleman said Monday that he hopes his colleagues will see that "voting for equality is not an anti-Republican move."
The Howard County Republican said he has offered to talk with fellow Republicans about why he supports gay marriage, and suggested some of the New York Republicans could serve as ambassadors, too.
New York state Sen. James S. Alesi, a Republican from the Rochester area, has said he'd be willing to talk with lawmakers in other states.
But while New York saw all but one of its Democratic senators back same-sex marriage, the majority party in Maryland was splintered.
Some Democrats from Baltimore and Prince George's County said their constituents disapprove overwhelmingly of gay marriage. African-American churches led the push against the bill, preaching about it on Sunday and urging their thousands of congregants to contact lawmakers.
Maryland Attorney General Douglas Gansler, an outspoken supporter of gay marriage, said leaders in the African-American community "could be the real difference in Maryland."
"That's the group where there were the most defections," he said. "If you can win back those votes, there's no need for Republican support here."
The Maryland Black Family Alliance, a group of religious leaders, elected officials and others who support same-sex marriage, is building a message for next year.
"The African-American community is broad and diverse in religion and in its focus on issues," director Elbridge James said. "What we want to do is work through some of the issues in our community to give protection to all of us."