PORTLAND, Maine — Voters on Tuesday repealed the state’s same sex marriage law after an emotionally charged campaign that drew large numbers to the polls and focused national attention on Maine.

With 87 percent of precincts reporting, the campaign to overturn Maine’s same-sex marriage law won with 53 percent of the vote vs. 47 percent opposed to Question 1, according to unofficial results compiled by the Bangor Daily News.

Gay-marriage opponents claimed victory shortly after 12:30 a.m. Wednesday.

“Question 1 has passed,” Frank Schubert, campaign manager of Stand for Marriage Maine, announced in Portland. “It has all come together tonight and the institution of marriage has been preserved.”

About 40 people who worked on the Yes on 1 campaign cheered as they heard the announcement by computer hookup at Jeff’s Catering in Brewer.

“We went up against tremendous odds,” Marc Mutty, public affairs director for the Roman Catholic Diocese of Portland who has been on loan to the campaign, said from Portland. “We all know we were the little guy going up against the big guy, but we prevailed. We prevailed because the people of Maine — the silent majority — the folks back home spoke with their votes.

“What they had to say,” Mutty continued, “is marriage matters because it’s between a man and a woman. [This campaign] has never been about hating gays, but about preserving marriage and only about preserving marriage, and that’s what we did tonight.”

The defenders of Maine’s gay marriage law — which passed the Legislature in the spring but was never allowed to take effect — acknowledged being behind, but held out hope for a bump as the final votes and absentee ballots were counted.

In a defiant speech to several hundred lingering supporters, No on 1 campaign manager Jesse Connolly pledged that his side “will not quit until we know where every single one of these votes lives.”

“We’re not short-timers; we are here for the long haul,” Connolly told the crowd, some of whom wiped away tears as he spoke. “Whether it’s just all night and into the morning, or next week or next month or next year, we will be here. We’ll be fighting, we’ll be working. We will regroup.”

The Yes on 1 campaign, led by the group Stand for Marriage Maine, built its lead by winning votes in rural Maine as well as in some larger towns such as the Roman Catholic and Franco-American stronghold of Lewiston.

In contrast, the effort to defend Maine’s gay marriage law won strong support in places such as Portland, where 73 percent voted against Question 1, and majority support in Bangor.

Throughout the campaign leading up to Tuesday’s closely watched election, both sides had said that turnout would be key. State election officials estimated earlier Tuesday that turnout likely would top 50 percent.

But while gay marriage supporters hoped the high voter interest would provide a boost, it was not enough to make Maine the first state in the nation where gay marriage won at the polls rather than in the legislature or courts.

Despite the outcome, Mary Bonauto, a No on 1 executive board member and attorney with Gay and Lesbian Advocates and Defenders, said she was never more proud to live in Maine and raise a family with her long-term partner. She was especially proud of the attention the No on 1 campaign brought to the values shared by all families, regardless of sexual orientation.

“I look around at the 8,000 volunteers, and the vast majority are not gay people,” Bonauto said. “So that gives me hope that, regardless of the outcome, that this discussion has changed the state.”

At the No on 1 election-watch party, what began as an exuberant crowd of more than 1,000 began to steadily dwindle as the Yes campaign’s lead held steady. By 12:30 a.m. Wednesday, a few hundred die-hard gay marriage supporters still remained in the ballroom as Connolly spoke, but the disappointment was palpable.

With relatively few high-profile elections around the country, the national media spotlight is on Maine. Had Question 1 been defeated, Maine would have become the first state in the nation where same-sex marriage was legalized at the ballot box.

Secretary of State Matt Dunlap, after witnessing activity at several polling stations and hearing from clerks around the state, said he believed at least 50 percent of voters may have cast ballots in the off-year election dominated by the gay marriage issue.

“What I have seen around the state has been steady to very busy turnout all day,” Dunlap said.

The lead-up to Tuesday’s historic election began back in April when more than 3,000 people crammed into the Augusta Civic Center for a public hearing on the bill.

Lawmakers sat through more than 10 hours of impassioned, sometimes tearful testimony from longtime gay and lesbian partners as well as children of same-sex couples. The bill’s opponents were equally passionate, often citing religious objections to redefining marriage from the traditional one-man, one-woman union.

Several weeks later, both chambers of the Legislature signed off on the bill, LD 1020, and sent it with some trepidation to Gov. John Baldacci, who had been on record previously as favoring civil unions and domestic partnerships over same-sex marriages.

But Baldacci immediately signed the bill, making Maine the fifth state in the nation to grant gay and lesbian couples marriage rights.

“When history shines a spotlight on you, you have an opportunity to advance the cause or to let the cause slip backwards. I chose to move things forward,” Baldacci said recently.

Even before Baldacci had put his pen to the bill, however, opponents announced the petition drive to gather enough signatures to trigger a “people’s veto” referendum. They easily surpassed the 55,000-plus required signatures.

In the months since, the two campaigns have spent more than $6.5 million on the campaigns, with money flowing into their coffers from organizations and individuals from outside of Maine.

Although the campaign is over, the Rev. Bob Emrich of Palmyra said that the work of traditional marriage supporters was not.

“This doesn’t mean it’s the end of our work,” he said. “We must begin building bridges and we may have to mend fences. People on the other side were doing what they believed in, too.

“God has given us this victory,” Emrich continued, “and it is very important for us to recognize that he is the one who put the energy into this campaign. So let’s not be so arrogant to forget this. It’s very appropriate to pause for a moment of prayer.”