The midterm election was devastating for Republicans in the Philadelphia suburbs.

Losses piled up everywhere on the Pennsylvania side of the Delaware River: Two seats in the U.S. House, four in the state Senate, and 12 in the state House went down the drain.

In the races for governor and the U.S. Senate, GOP candidates lost by double digits in the city's collar counties.

Many political observers point to the political undertow effect of an unpopular President Trump, but it seems unlikely that the GOP's troubles with voters in Bucks, Chester, Delaware, and Montgomery Counties will immediately evaporate when he leaves office.

Instead, the data show that the suburbs have been undergoing a fundamental political realignment for two decades that favors Democrats, a transformation matched in other metropolitan areas across the nation:

  • Since 1998, the number of registered Democrats in the city's suburbs has risen by 75 percent.
  • Even as the overall population has climbed, the number of registered Republicans in the region has fallen by 14 percent.
  • Since 2000, Democrats have made steady gains in elections for president, U.S. Senate, attorney general, auditor general, and treasurer. They've also made historic pickups in recent municipal races.
  • At the same time, the suburbs have become more racially diverse, better educated, and home to more young adults — thus more resembling the modern Democratic base.

The suburbs' move to the left is a dramatic transformation for an area that was once a key part of the GOP coalition, and it could spell trouble for Republicans at all levels of government, up to the presidency.

"There is a red flag for Republicans there," said Charlie Gerow, a GOP strategist based in Harrisburg.

Part of the problem, he said, is that college-educated white voters are disenchanted with the party. But that's not all: "Republicans are going to have to do better with millennials and with minorities. I think that's the challenge of my party over the course of the next two years."

The shifts in the suburbs have coincided with the rise of cultural conservatism in the national GOP and accelerated under Trump's nationalism.

The demographic shifts underway in the Philadelphia suburbs are among the key indicators that suggest the political changes seen on Nov. 6 could last beyond Trump.

From 2005 to 2017, the collar counties have grown in population by 7.8 percent, according to Census Bureau estimates; but the white population actually fell in that time.

As a result, people of color went from making up 16.3 percent of the suburban population to 23.6 percent. Strong majorities of people of color vote Democratic, while white voters lean Republican.

All four counties also have experienced a rise in the percentage of adults with bachelor's degrees. Today, a majority of adults 25 or older in Chester and Montgomery Counties hold bachelor's degrees.

Voters with college degrees have become more likely to vote Democratic in recent years.

People ages 18 to 24 also make up a larger share of the adult population today than they did in 2005 in Chester, Delaware, and Montgomery Counties. And in Bucks County, their relative numbers remain unchanged. Young voters are more liberal than older generations.

As the suburbs have changed, so have the parties' fortunes.

Consider how the GOP has performed in the region in campaigns for the U.S. Senate.

Even though Republican candidates have won there in some recent races — Sen. Pat Toomey carried Bucks and Chester Counties in 2016 — the number of votes for the Democratic candidate was higher in 2012, 2016, and 2018 than in the previous four elections in all four counties.

President? Pennsylvania Attorney General? In the Philadelphia suburbs, the pattern is generally the same, whatever the office.

Both parties saw more votes cast for their presidential candidates in 2016 than in 2000, but votes for Democrats — which already outweighed votes for Republicans — increased at a much faster rate.

The Republican vote increased 17 percent, to 553,873 votes; votes for the Democratic candidate increased 40.6 percent, to 742,226.

The election results have coincided with a boost in registrations for Democrats.

Since 1998, the number of voters registering as Democrats has increased from 456,754 to 800,432, while Republican registrations have fallen from 819,760 to 707,509.

To be sure, registered Democrats can and do vote for Republicans, and vice versa, and some voters are unaffiliated with either major party.

Still, the data reveal changing political tides: In 2000, 19.2 percent of statewide votes for the Democratic candidate for U.S. Senate came from Bucks, Chester, Delaware, or Montgomery Counties. This month, that figure was 25.8 percent.

On the Republican side, the suburban share of the statewide Republican vote has fallen, from 22.8 percent in 2000 to 20.1 percent this year.

The locus of the GOP's power in the state Capitol has shifted, too, from Southeastern Pennsylvania to the western part of the state.

"When I first got elected 24 years ago, most leadership positions on the Republican side in the House were based in the Southeast," said State Rep. Gene DiGirolamo, a Bucks County Republican. "There's been a really dramatic change in where leadership is coming from."

Meantime, state House Democrats last week named three Philadelphia legislators to their leadership team, and a representative from Montgomery County won a post as ranking member of the influential Appropriations Committee.

Republicans recognized the challenges they face in the suburbs and offered a variety of paths forward, including focusing on policy issues like health care and gun control.

Val DiGiorgio, chairman of the Pennsylvania GOP, said the party should better reflect the changing face of the suburbs.

"We need to recruit more Latinos to run, more Asian Americans to run," he said. "In Chester [County], we've got a big Mexican community, we've got a large and growing Indian community. We need to do a better job of reaching out to those folks."

He also said the party needed to convince new residents in the suburbs, especially those coming from Philadelphia, that Republican governance helped make those places what they are.

"You moved here for a good reason: good schools, low taxes, low crime," he said. "[An] 'if-it-ain't-broke, don't-fix-it' kind of message."

Of course, demographics also don't have to be destiny, politics is cyclical, and trends reverse. Trump also won Pennsylvania in 2016 despite losing the Philly suburbs, largely because he racked up big victories in rural parts of the state.

One piece of evidence that the GOP can still succeed in the suburbs: U.S. Rep. Brian Fitzpatrick, a Bucks County Republican, won a tough reelection campaign after building a brand as a moderate. He received the support of labor unions, and publicized his vote against repealing the Affordable Care Act.

Reelected Rep. Brian Fitzpatrick, left, celebrates with his brother, former Rep. Mike Fitzpatrick, at the Bucks County GOP watch party in Doylestown, Pa., on Tuesday, Nov. 6, 2018. Fitzpatrick defeated Democratic challenger Scott Wallace.
TIM TAI / Staff Photographer
Reelected Rep. Brian Fitzpatrick, left, celebrates with his brother, former Rep. Mike Fitzpatrick, at the Bucks County GOP watch party in Doylestown, Pa., on Tuesday, Nov. 6, 2018. Fitzpatrick defeated Democratic challenger Scott Wallace.

Political analysts said Fitzpatrick's name on the ticket helped limit losses for down-ballot Republicans in Bucks County.

DiGirolamo, the state legislator, said Republicans could win back support in the Philly suburbs if GOP leaders in Harrisburg held votes to raise the minimum wage, levy a tax on Marcellus Shale gas drilling, and close a loophole on background checks at gun shows.

Said DiGiorgio, the state chairman: "We have to have a better message on health care."

But Democrats said they've built a foundation, starting with key wins at the county level in 2017, that will enable the party to grow.

"There are now people who are engaged in the suburbs who never thought to be engaged before," said Anne Wakabayashi, executive director of Emerge PA, which recruits and trains Democratic women to run for office. "Once you start volunteering for races, once you start donating politically, you don't stop. It is a habit."

At the same time, Democrats said, they can't count on demographic changes and will seek to push the suburbs more toward their party.

"I don't think anything is permanent in our electoral process, but I think this is absolutely a signal of the direction suburban Philadelphia and Montgomery County" are headed, said U.S. Rep.-elect Madeleine Dean, a Democrat who won a congressional race in Montco.

"We'll see what the Republican Party does to course-correct," she said.

Republicans aren't ready to cede the suburbs yet, but alarm bells have begun to ring.

"There's a slow demographic shift that moves — and it's moving — and that'll move at a slow percentage rate, and then you have these other shifts that are more transient, such as a president," said Andy Reilly, leader of the Delaware County Republican Party. Change now or the suburbs could become as winnable for Republicans as Philadelphia is, he warned.

"In Philadelphia," he said, "we're thrilled if we get anywhere near 20 percent" of the vote.

Staff writer Nathaniel Lash contributed to this article.