U.S. Rep. Brian Fitzpatrick, a Bucks County Republican who campaigned as a moderate and kept President Donald Trump at arm’s length, has won reelection even as most voters in Philadelphia’s collar counties have rejected the GOP under Trump.

Fitzpatrick defeated Democrat Christina Finello to win a third two-year term representing a perennial battleground district that Hillary Clinton narrowly carried in 2016, and where strategists in both parties expected Joe Biden to win easily.

Fitzpatrick was the only congressional Republican in the Philadelphia region who survived the much-ballyhooed blue wave of the 2018 midterm elections. Three Democratic women flipped GOP-held seats in the Philly suburbs that year, a result aided in part by the Pennsylvania Supreme Court’s redrawing of gerrymandered congressional districts.

Fitzpatrick represents Pennsylvania’s 1st District, which spans all of Bucks County and a sliver of Montgomery County.

A former FBI agent, Fitzpatrick was first elected in 2016 after his brother Mike retired from Congress, vacating the seat. Fitzpatrick sought to cultivate a similar independent profile similar to his brother’s, joining the bipartisan Problem Solvers Caucus in Congress, building relationships with labor unions and other groups that tend to support Democrats, and breaking with his party on some high-profile votes.

For example, in 2017 he opposed the GOP’s efforts to repeal the Affordable Care Act, and this year he was one of just three Republicans who voted for the police reform measure advanced by House Democrats after the police killing of George Floyd in Minneapolis. And he declined to say whether he’d vote for Trump.

His campaign ads told voters Fitzpatrick was “Ranked #1 Most Independent in U.S. History” — a reference to his top ranking in the “Bipartisan Index” of House members created by the Lugar Center and the McCourt School of Public Policy at Georgetown University, which uses data dating back to 1993.

But Finello, an Ivyland Borough council member, argued that Fitzpatrick stood with Trump when it counted most, pointing to Fitzpatrick’s vote for the 2017 GOP tax cuts that disproportionately benefited the wealthy. Tucked into the tax legislation was a provision that eliminated the penalty faced by taxpayers who refuse to buy health insurance under the Affordable Care Act.

Republican state attorneys general filed a lawsuit, joined by the Trump administration, alleging that because Congress invalidated Obamacare’s so-called individual mandate in the tax law, the whole law must be struck down. The case is pending before the U.S. Supreme Court.

Democrats used that opening to air TV commercials accusing Fitzpatrick and Trump of working to “end protections for people with preexisting conditions” — a popular Obamacare provision that Republicans have insisted they would protect, though they have offered no comprehensive health-care plan. Fitzpatrick, the commercials said, was the “one congressman from our area [who] voted for Donald Trump’s agenda.”

Just as health care is the go-to Democratic playbook in congressional races, Fitzpatrick’s campaign and Republican allies went after Finello with an attack deployed by the GOP in races across the country: The Democrat did not stand with law enforcement.

GOP television commercials showed kids playing in playgrounds while their moms worried about Finello’s “radical” supporters who, the ads charged, wanted to “defund the police.”

Finello said she didn’t support the cause.

Democrats began the election cycle worried about their recruiting prospects in the district. Ultimately, they thought Finello had a shot, especially given the Democratic Party’s 2019 takeover of the Bucks County board of commissioners and other gains in local races.

Fitzpatrick had the advantage on the airwaves: His campaign and outside GOP groups spent $7.1 million on commercials between Sept. 1 and Election Day, while Finello and Democratic groups spent $4.8 million, according to the ad-tracking firm Advertising Analytics.