Democrats said the Philadelphia region would play a key role in their campaign to win control of the U.S. House — and they were right.

In the most-anticipated midterm election in recent history, Democrats gained four seats in the area, roughly one-sixth of the 23 pick-ups they needed nationally to expel Republicans from power in the chamber. Women made up the majority of those winners.

Analysts on both sides of the aisle had anticipated that voters would use the midterms to render a verdict on President Trump.

"When the economy is as strong as it is, for Democrats to take back the House is a referendum on Trump," said former Democratic Gov. Ed Rendell.

Democrat Mary Gay Scanlon, a lawyer, defeated Republican Pearl Kim, a former prosecutor, in Delaware County. Democrat Chrissy Houlahan, an Air Force veteran who ran against tax lawyer Greg McCauley, won in Chester County.

In Montgomery County's Fourth District, State Rep. Madeleine Dean, a Democrat, turned aside Republican businessman Dan David.

Democrat Madeleine Dean celebrates after winning Pennsylvania’s Fourth Congressional District.
Charles Fox / Staff Photographer
Democrat Madeleine Dean celebrates after winning Pennsylvania’s Fourth Congressional District.

Democrat Susan Wild, a former city solicitor, triumphed over the Lehigh Valley's Seventh District vs. Republican Marty Nothstein, an Olympic gold medalist.

In New Jersey's Second Congressional District, Democrat Jeff Van Drew also came out ahead in a closer-than-expected race against Republican Seth Grossman.

By early Wednesday, Democrats throughout Pennsylvania had won a total of nine congressional seats. They began with six, resulting in a net gain of three seats — which, added to Van Drew's victory, meant four pick-ups in the region.

Brian Sokel, a 44-year-old Montgomery County resident, was one of the Pennsylvania voters who cast a ballot for Democrats.

"I would have voted for a head of cabbage against anything that was Donald Trump," he said, adding that the president has capitalized on "fear and hatred."

In Chesterfield, Richard Loninger held a different philosophy. He voted to maintain the direction the country is heading in, a direction that he said it has only recently turned toward.

"Values have been re-established that our forefathers initiated," Loninger, 50, said. "Low taxes, less government, more freedom, and less intrusive government. The bottom line is that it's leftism versus liberty."

In Pennsylvania, which currently has an all-male delegation, four of the Democrats heading to the House for the first time are women.

Nimra Khan, a 25-year-old Bucks County resident, said she voted for all Democratic candidates "because I have a uterus."

At least one reason Democrats gained seats in Pennsylvania had nothing to do with Trump: In January, the state Supreme Court tossed out the congressional district map as unconstitutionally gerrymandered and created districts that were more favorable to Democrats.

"When you un-gerrymander a state, as our intrepid Supreme Court has done, you create a climate where our representatives are no longer in blood-red districts or sapphire-blue districts," said Democratic Rep. Matt Cartwright, who was reelected Tuesday in Lackawanna and Luzerne and Counties. "They're in districts that could change hands."

Across Pennsylvania and New Jersey, there were reports Tuesday of extraordinarily high turnout for a midterm election.

Democratic congressional candidates in the region sought to tie their opponents to Trump, while talking up issues such as health-care reform and gun control. The area's Republicans touted their bipartisan bona fides and painted their opponents as extremists with ties to people such as cop-killer Mumia Abu-Jamal.

Voters in the nation's battleground districts said Trump and health care were the most important issues in the election, according to preliminary data from a Washington Post-Schar School poll.

One Republican who didn't get hit by a "blue wave" was Pennsylvania Rep. Brian Fitzpatrick. He survived a challenge by Democrat Scott Wallace, a multimillionaire philanthropist who invested at least $8 million of his own money in the race.

Fitzpatrick ran as a moderate Republican, highlighting his vote against repealing the Affordable Care Act and winning support from the area's powerful labor unions.

"The message is that Brian Fitzpatrick has developed his own identity and brand, and that he very much reflects the values and interests of Bucks County," said Republican Charlie Dent, a former Lehigh Valley congressman who resigned this year. "That's why he would prevail in spite of this atrocious political environment."

The race for Bucks County's First District was one of the most closely watched and expensive in the nation, costing at least $26 million.

Rep. Brian Fitzpatrick, left, celebrates his reelection with his brother, former Congressman Mike Fitzpatrick at the Bucks County GOP watch party in Doylestown.
Tim Tai / Staff Photographer
Rep. Brian Fitzpatrick, left, celebrates his reelection with his brother, former Congressman Mike Fitzpatrick at the Bucks County GOP watch party in Doylestown.

In Pennsylvania's Tenth District, Republican incumbent Scott Perry fought off a challenge from Democrat George Scott.

Democrat Mikie Sherill, a former Navy pilot and former federal prosecutor, prevailed over Republican Jay Webber in New Jersey's 11th District, according to news reports.

Ballots are still being counted in one hotly contested race in New Jersey. U.S. Rep. Tom MacArthur ended his Election Night party without speaking Tuesday night and a representative said the race was too close to call against Democrat Andy Kim.

"Ocean County gave Tom MacArthur a 30,000-plus victory margin, but unfortunately Burlington County was not so kind," said Ocean County Republican Chairman George Gilmore. "But we think he's still ahead. But we will still have to count provisionals and absentee votes."

In Mount Laurel, Kim spokesman Forrest Rilling said the campaign wasn't going anywhere: "We're still here. We're still confident."

With 99 percent of the ballots tallied, results showed MacArthur with a lead of about 2,300 votes.

The fiercely fought contest pitted the two-term incumbent MacArthur, 58, a former insurance executive and mayor of Randolph in North Jersey, against Kim, 36, a Rhodes scholar and national security adviser in the Obama administration who was raised in Marlton.

The night's split decision highlighted the divided South Jersey district that joins the Democrat-heavy Burlington County in Philadelphia's suburbs with the Republican and retiree stronghold of Ocean County, divided by the Pinelands.

Groups like South Jersey Women for Progressive Change and Action Together New Jersey, and its Burlington County spin-off, created after Trump's election, built extensive voter databases and organized canvassing alongside national groups like Swing Left.

In North Jersey's Seventh District, Democrat Tom Malinowski won against Republican incumbent Leonard Lance in an area that includes Bedminster, home of Trump's golf club.

When their party takes control next year, House Democrats in the area said, infrastructure and health care would be at the top of their list of priorities.

Rep. Brendan Boyle, an incumbent who won handily in a solidly blue district, said "any effort to kill the Affordable Care Act" is now "dead … which is very good news."

Some Democrats even said they believe they could find common ground with Trump, particularly on legislation to repair the nation's roads, bridges, and other infrastructure.

"I don't care if he takes credit for it," said Cartwright. "It's the right thing for the country."

Staff writers Vinny Vella, Stacey Burling, and Gillian McGoldrick contributed reporting to this article.