Capuano acknowledged the district’s desires in remarks after early returns showed him losing his old political base to the challenger.

“Clearly, the district wanted a lot of change,” Capuano said. “Ayanna Pressley is going to be a good congresswoman.”

AD

Pressley, 44, is set to become the first black woman to represent Massachusetts in Congress, as Republicans are running no candidate in the 7th District. Capuano, 66, first won the seat in 1998 but struggled to keep up with Pressley as she argued that a young and majority-nonwhite district needed a fresh voice in Washington.

AD

“I fundamentally believe that the people closest to the pain should be closest to the power,” Pressley said on the trail.

Capuano is the second Democrat, and the fourth member of Congress overall, to lose a renomination battle in 2018, following the surprise defeat of Rep. Joseph Crowley (D-N.Y.) by Alexandria Ocasio-Cortez. New England has never previously elected black women to Congress; Pressley and Connecticut’s Jahana Hayes are both favored to win in November.

AD

AD AD

Two other Massachusetts Democrats, Reps. Stephen F. Lynch and Richard E. Neal, easily defeated female challengers who ran to their left, and a close race was underway in the 3rd Congressional District, where the seat is being vacated by Rep. Niki Tsongas. But in Pressley’s words, she “did what Massachusetts Democrats aren’t supposed to do” — unseat an incumbent who had much of the political establishment behind him, on a slogan of “change can’t wait.”

AD

Republican voters, meanwhile, nominated Gov. Charlie Baker for a second term, and picked conservative state legislator Geoff Diehl to challenge Sen. Elizabeth Warren (D).

Democrats nominated former state finance secretary Jay Gonzalez for governor, and longtime Secretary of the Commonwealth Bill Galvin defeated a liberal challenger by a landslide.

AD

But the Capuano-Pressley race, which split Massachusetts Democrats and national liberals alike, had drawn the most attention. Capuano has been one of the House’s most reliably left-wing votes, especially on issues of war and defense funding. Pressley, a former Capitol Hill staffer long seen as a political star, had argued that she could lead “a movement” from the seat while Capuano was content to simply vote the right way.

Polling found a consistent lead for Capuano, who locked up endorsements from Boston Mayor Marty Walsh and most local labor unions. But Warren and some other Democratic leaders stayed neutral in the race, while the Boston Globe and a number of local liberal groups backed Pressley. The challenger got a burst of attention after Ocasio-Cortez defeated Crowley with a similar message.

AD

“Representation does matter,” Pressley said in an interview while campaigning last week. “Many would just say: Your job is the vote. I’m saying that your vote is just one part of the job.”

AD

In a separate interview, Capuano said that he’d built “a very progressive record” in Congress, despite frequent opposition and that a freshman arriving in 2019 would not be able to deliver as much for the district.

“All politics is built on relationships, and Congress is no different,” he said.

The primary flummoxed national Democrats, who saw a rising star in Pressley but a reliable and scandal-free congressman in Capuano. The congressman, who had run as an insurgent candidate himself when first winning the seat, had opposed the Iraq War, backed the Affordable Care Act and opposed efforts to deregulate banks.

AD

But Pressley ran to Capuano’s left on a few key issues, calling for the abolition of Immigration and Customs Enforcement and for restoring voting rights to prisoners. She also gained an advantage over Capuano when the congressman groused that Democrats were becoming “balkanized” by racial identity.

AD

“This is not just a blue wave; this is a movement that’s coming to Congress,” Ocasio-Cortez said in June at an appearance with Pressley, before either had won her race.

“When we had the Women’s March, they thought that was a moment,” Pressley said at the event. “We had signs that said: ‘Today we march, tomorrow we run.’ And they didn’t believe it!”

Republicans never intended to contest the 7th District, which gave Hillary Clinton 84.1 percent of the vote in the 2016 presidential race and was previously represented by Democratic Party legends Tip O’Neill and John F. Kennedy.

AD

But the race to challenge Warren was crowded; Republicans spent a combined $8.4 million on the primary, even though polling has shown Warren ahead by 30 points or more against any of them. Diehl, whose campaign has sold Trump-style hats with the slogan “Make Warren Teach Again,” said he would challenge her as an elitist out of touch with a state that had been too highly taxed.

AD

“There’s a path to win here,” Diehl said in an interview last week. “There’s a Rust Belt here in Massachusetts, and people there feel the same way that people in Pennsylvania, Wisconsin and Michigan felt in 2016.”

Republicans, who are more hopeful that Warren can be damaged than beaten outright, were far more confident at the top of the ballot. Baker, a moderate who often breaks with President Trump, easily defeated Scott Lively, an anti-gay-rights activist who pledged to become “the most pro-Trump governor in America.”

AD

That left most of Tuesday’s drama in Democratic primaries, with candidates of the left challenging Democrats seen as too willing to compromise or too indebted to donors.

AD

Several state legislators were struggling against challengers, including Jeffrey Sanchez, a Democrat who had been criticized for axing language in the state budget that would have cut off state funding for ICE. Rachael Rollins, an attorney who promised to end “mass incarceration” and challenge ICE, won the Democratic nomination to represent Suffolk County — the city of Boston and some suburbs — as district attorney.

In the 3rd Congressional District, which Tsongas has represented since 2007, 10 Democrats were competing to represent an increasingly diverse and liberal electorate; Trump won just 35.4 percent of its 2016 vote.

Late Tuesday night, the race was tight: a dead heat between Lori Trahan, a former chief of staff to Tsongas’s predecessor and Dan Koh, a former chief of staff to Mayor Walsh, with state legislator Juana Matias closely behind.

AD

AD

Koh raised more than $3 million — more than any of the state’s incumbent members of the House, except for Rep. Joe Kennedy III (D). But that hardly cleared the field, with Trahan stacking up more than $1 million, and every candidate trying to stake out space as a liberal who would expand Medicare and curtail the Trump administration’s immigration policies.

The winner of Tuesday’s primary will face Republican Rick Green, the CEO of an online auto parts company who has partially self-funded his campaign. But national Republicans have not prioritized any of Massachusetts’s House races, and they have no candidates in four of the state’s nine districts.

In two of those districts, Tuesday found the Democratic Party’s liberal insurgency falling short. In the 1st District, which covers the cities of Springfield and Northampton, Rep. Neal defeated Muslim attorney and activist Tahirah Amatul-Wadud.

AD

In the 8th District, which covers south Boston and some of the city’s suburbs, Rep. Lynch dispatched Brianna Wu, a video game designer who was targeted by far-right activists in 2014 for defending women in her industry during the #Gamergate controversy.