AUGUSTA, Maine — Maine Democrats claimed majorities in both chambers of the Legislature on Wednesday, reversing control of the State House just two years after the Republicans won leadership roles for the first time in nearly 40 years.

Democrats won 19 seats in the Senate and 87 seats in the House, according to unofficial election results collected by the BDN. Among these seats are more than 20 where the vote difference between the winning and losing candidates was less than 2 percent. In such instances, there is no cost for the apparent loser requesting a recount, which must occur within five business days. Recounts can be requested in races with larger vote differences, but those requesting a recount must put up a deposit between $500 and $10,000.

In two races, the number of votes separating the candidates was fewer than 10.

Nevertheless, Democrats won at least 19 Senate seats and 77 House seats by margins of more than 2 percent, according to the BDN’s projections. Majority control requires 18 seats in the Maine Senate and 76 seats in the House.

Story continues below advertisement.

After a 2010 election that plunged legislative Democrats into minority status in both the Maine House and Senate for the first time since 1974, party officials made winning back the Legislature their primary focus for 2012. This year’s stakes include committee chairmanships and greater power over 10-year legislative redistricting, in addition to the upper hand in electing the secretary of state, attorney general and treasurer.

With Tuesday’s success, the state’s Democrats are “ready to work,” according to party Chairman Ben Grant.

Republican Gov. Paul LePage, who joined GOP legislators in 2010’s State House victory march, also reacted to Tuesday’s election results with a call to work.

“I would like to congratulate all candidates who won. Now that the campaign is over, it is time to get to work for all Maine people,” LePage said in a statement Wednesday. “Here in Maine, we must come together to find solutions to our fiscal challenges that will lead to the recovery of our economy and improve prosperity for hardworking families and businesses. I stand ready to work with those who will put Mainers first and won’t allow the political rhetoric to continue.”

But can LePage, who sometimes had trouble working with the Republican-run 125th Legislature, forge anything but a rhetoric-riddled working relationship with the 126th Legislature, which will be led by Democrats who find themselves in a position to set an agenda that competes with the governor’s? Especially if some of those Democrats based their successful campaigns on opposition to LePage’s positions?

On matters such as the LePage administration’s ongoing dispute with the federal government over proposed Medicaid cuts and state borrowing, a Democrat as attorney general or treasurer could easily clash with the governor on policy, strategy and legality.

“It will be fascinating to watch,” said University of Maine political science professor Mark Brewer. “The governor does not exhibit willingness to compromise or work across the aisle on many issues. I expect pretty serious showdowns during the next two years on some pretty serious issues. I don’t think compromise is in Paul LePage’s DNA.”

Dan Demeritt, LePage’s former communications director who now works as a Maine political consultant, said this year’s legislative turnover will likely put the governor on the defensive. “He’s going to have to adjust his approach and spend more time building coalitions and agreements,” Demeritt said. “A lot of it will be reactive. He’ll have to be strategic on budget bills and things that have to pass to put himself in a position to advance initiatives he really wants.”

Pointing to LePage’s speech during the May 2012 state GOP convention as the sole unifying moment in an otherwise fractured event, Demeritt said LePage showed an ability to break down factions within the Republican party. But because LePage and Democrats differ so markedly on policy and their approach to government, actions that coalesced squabbling Republicans might drive Democratic lawmakers further away.

And Democrats seem intent on undoing many of the initiatives that LePage and GOP lawmakers trumpeted as their greatest accomplishments of the past two years.

“For two years we’ve seen Gov. LePage and his Republican allies push a partisan agenda that left our economy and the middle class behind,” Emily Cain, House minority leader in the 125th Legislature who won a Senate seat in the next Legislature, said Wednesday in a Maine Democratic Party release.

Brewer and Demeritt agree that Democrats’ successes in Tuesday’s legislative races stand more as a repudiation of LePage’s and the Republican-led 125th Legislature’s policies than a referendum on the governor himself.

“I do believe there is some pushback to LePage-led initiatives,” Brewer said.

“The governor rallied the base, the party activists, but I don’t think he energized voters,” Demeritt said. “I don’t think many people went to the polls to vote against Paul LePage.”

Democrats made a point of campaigning against LePage’s policies, not his often bombastic personality, Grant insisted prior to Election Day. “If you took an honest look at what we’ve done, we have not attacked Paul LePage the person,” he said. “It’s his agenda. Our agenda is to make sure that Maine does not go off in a bad direction.”

LePage benefited from running in a five-person gubernatorial contest in 2010, Brewer said. That allowed him to triumph with less than 40 percent of the vote, which consistently reflects the governor’s approval rating in public opinion surveys. With few exceptions, legislative candidates this year competed in two-person races, which swung close races against Republicans this year, Brewer surmised.

Cautioning that the absence of exit polls limits post-election analysis to conjecture, Brewer theorized that Democrats did a better job of targeting record amounts of outside spending at vulnerable Republican incumbents. Citing first-term Republican state Sen. Nichi Farnham of District 32, which includes Bangor and Hermon, as an example, Brewer said Democrats targeted “marginal seats” that the GOP won in 2010, but “which were harder to defend the next time around.”

Other examples of 2010 Republican victors ousted this year include Sen. Garrett Paul Mason of District 17 (pending a likely recount), Sen. Thomas Martin of Senate District 25, Sen. Lois Snowe-Mello in Senate District 15 and Rep. Kimberly Olsen of House District 64.

The same-sex marriage referendum and higher than anticipated excitement in Maine about President Barack Obama’s re-election bid also benefited Democratic legislative candidates this year, according to Brewer.

The immediate take-away from Tuesday’s legislative vote is that 2010 served as a harsh wake-up call for Maine Democrats, who had begun to expect legislative majorities as a “birthright,” Brewer said. They responded to that slap with a better orchestrated campaign strategy that mobilized voters, more effectively directed outside spending in a way that would win more races and “put their candidates in a better position to win,” Demeritt said.

Two strong congressional incumbents and a decision — based on the hope that independent Sen.-elect Angus King will caucus with Democrats — to invest little in Cynthia Dill’s U.S. Senate campaign allowed Maine Democrats to make the Legislature this year’s top prize.

In the end, that contest proved to be less about LePage than about Grant’s ability to outmaneuver Republican Party Chairman Charlie Webster in the legislative campaign ground game.

“They were a disaster in shambles after 2010,” Republican political consultant Vic Berardelli said of the Maine Democratic Party. “Grant came in and reorganized. They had people in the streets and did what they had to do to win the election.”

CORRECTION:

An earlier version of this story incorrectly stated that Democrats had won 21 seats in the Maine Senate. Revised election numbers show that number has been reduced to 19.