By Jordan Fenster and Luther Turmelle

Democrat Elizabeth Esty narrowly defeated Republican Andrew Roraback in the race for Connecticut’s 5th District Congress seat Tuesday thanks to huge margins of victory in New Britain and Waterbury.

She won 144,687 to 136,599, or 51.4 to 48.6 percent.

The final margin of victory for Esty, a former Cheshire town council member and one-term state representative, was 8,088 votes. She would have lost badly without the district’s four major cities, Danbury, Meriden, New Britain and Waterbury, where she won by a combined margin of 26,349 votes.

Roraback, a state senator from Goshen, won 30 of the 5th District’s 41 communities. But as the night wore on, it increasingly looked like Esty was headed to victory on the strength of her big margins in the cities and scattered, narrow victories in her native Cheshire, Salisbury, Kent, Cornwall, Norfolk, Plymouth and Plainville.

“Democracy is us stepping up and making change for our families,” Esty said just before midnight to a group of supporters gathered at a hotel in Waterbury. “It’s a fight worth having. It’s a fight we’re engaged with.”

“The goal is simple and it’s clear: to bring common sense problem solving to Washington,” she said. “We proved in the Senate, we proved in the House, Connecticut can not be bought.”

See town-by-town election results here.

After Roraback built a more than 7,000-vote advantage early, Esty moved into the lead in one fell swoop as Waterbury results came in Tuesday night. She won there by a more than 2 to 1 margin, 15,873 to 6,787, a huge improvement over past Democratic margins in that city.

Roraback won big in Northwest Connecticut communities familiar with his 18-year career as a state legislator, and he improved on margins in other 5th District communities that Republicans won two years ago.

Roraback supporters gathered at the Backstage restaurant in Roraback’s hometown of Torrington said that Republican U.S. Senate candidate Linda McMahon’s unpopularity with women and independents “dragged down the ticket” and harmed Roraback’s candidacy.

McMahon spent $47 million of her own money in a second failed Senate bid in two years. She was defeated by the man Esty will replace, 5th District Congressman Chris Murphy.

Esty and Roraback both had to emerge from bruising party primaries, with Esty defeating scandal-plagued Speaker of the House Chris Donovan and a well-financed newcomer who was endorsed by former President Bill Clinton and other political celebrities, and Roraback emerging in a four-way race also plagued by scandal and negative attacks.

In their primaries, Esty and Roraback were criticized from the left and the right, respectively, for being too moderate.

The day after that vote, however, Esty and the Democratic Congressional Campaign Committee put significant money and rhetoric into trying to paint Roraback as an extremist who would cut Social Security and go along with far-right Republicans in Washington.

Roraback touted his track record in the legislature of bucking his party to support gay marriage, abortion rights and environmental issues. And he attacked Esty for taking campaign contributions from businesses regulated by the Connecticut Department of Energy and Environmental Protection, the state agency her husband oversees as commissioner.

In conceding to Esty on Tuesday night, Roraback called on the Republican majority in the U.S. House of Representatives to work with Democrats.

“I’m leaving here with a smile on my face,” he said after thanking supporters and telling them he had “no regrets” and that “this has been the most amazing experience of a lifetime.”

“What a great win for Elizabeth Esty, and the people who live in the 5th District.,” Gov. Dannel Malloy said in a statement following Roraback’s concession. “Elizabeth started this race as a huge underdog, but she never stopped fighting for what she believes in.  She’s exactly the type of person Congress needs more of: smart, tough, compassionate, and fiscally responsible.  The people who live in the 5th District could not have a better person representing them in Washington, D.C.”

Leading up to the vote, Roraback’s campaign released internal polling that showed him up 45 to 39 percent, with a significant number of undecided voters remaining. Esty’s campaign, in turn, released an internal poll of its own showing her up 46 to 42 percent.

And in the closing weeks of the campaign, several national political analysts moved the race from “leans Democrat” to “too close to call,” something that the Roraback campaign claimed as a momentum swing in his favor.

The 5th District this year is the first “open” congressional seat in Connecticut, with no incumbent running, in 14 years. It’s being vacated by six-year incumbent Chris Murphy, a Democrat who appeared headed to a successful campaign against McMahon to succeed the retiring Joe Lieberman in the U.S. Senate.

The race was officially the most expensive congressional campaign in Connecticut history. In addition to the approximately $4 million raised directly by the candidates themselves, numerous outside groups, from the Democratic Congressional Campaign Committee for Esty and a Super PAC funded by New York City Mayor Michael Bloomberg for Roraback spent millions on TV ads.

One of those groups was Emily’s List, which supports pro-choice female Democrats running for higher office. It sparked controversy by weighing in strongly on Esty’s behalf starting in the Democratic primary against an equally pro-choice Donovan.

The group was quick to trumpet Esty’s victory on Tuesday night.

“Elizabeth Esty is an outstanding progressive leader with a sterling record of public service,” said Stephanie Schriock, president of EMILY’s List. “This election provided a clear choice between leaders like Elizabeth Esty who want to move forward by expanding opportunities for women and families, and those who would roll back the clock by blocking access to reproductive health care and equal pay.”

Despite Roraback’s pro-choice record, Esty campaigned on the premise that he would be bad for women due to his vow to repeal President Obama’s Affordable Care Act and because he’d be one more vote keeping anti-abortion and misogynist Republican leaders in power.

The results were a tale of two districts. In rural areas, one would have thought that Roraback would take it by a landslide. In the cities, which at the end of the day had more votes, it was Esty by a huge margin.

Torrington Mayor Ryan Bingham was at the polls all day talking up Roraback.

“Three-to-one, almost, I see people coming out for Andrew, because they know him,” Bingham said. “I’m a little biased, being in Torrington. But it seems overwhelmingly positive for Andrew,” he said. “I’m not in the, for lack of a better word, swing areas.”

At the polls, many voters said they were voting for Roraback, but some Democrats were voting down the party line.

At the Torrington Armory, Victor Madia and his mother, Catherine, went different ways in the 5th Congressional District.

“I am a Democrat because I like Democratic people,” Catherine Madia said. “Republicans are rich for the rich.”

Her son, however, identified as an independent.

“I voted for who I thought would do the best job,” he said.

Henry, a Torrington voter who refused to give his last name, said he hadn’t paid too much attention to the 5th Congressional District race, overshadowed as it was, he said, by the presidential contest.

Nonetheless, Henry said he had voted for Roraback.

“I’m familiar with Roraback,” he said.

Annette Lenart said she voted for some Democrats on the ballot, but had filled in the bubble for Roraback for the same reason: “Because I’m familiar with Andrew Roraback.”

Other voters, like Catherine Madia, chose the party over the individual candidates.

Rocco Palladino, for example, from Torrington said he “voted straight Republican.”

“Because I don’t like Democrats,” he said.

In Cheshire, where Elizabeth Esty voted Tuesday morning, Democratic Registrar of Voters Aleta Looked predicted turnout could top 80 percent.

Esty, who was expected to hit 19 polling places during the course of Election Day, had been to polling places in Waterbury, Danbury and Newtown before arriving in Cheshire.

“Some people had questions for me, so that’s the reason you go to the polls,” she said. “People ask about the (political) ads, what about this, what about that.”