Like other Republicans in the House Freedom Caucus, Representative Scott Perry of Pennsylvania, the group’s former leader, carries a pungently far-right portfolio.
He has been an unswerving loyalist of former President Donald J. Trump. He has bickered with his party’s elected leaders. He has voted against aid to Ukraine and against keeping the government open. He still maintains that the 2020 election was stolen. Such stances are not especially controversial to Republican primary voters.
But among archconservative House members, only Mr. Perry must sell those same views to voters in a politically competitive district this November.
The challenge confronting Mr. Perry came into sharper focus late Tuesday night, when Democratic voters in Pennsylvania’s 10th Congressional District elected as their candidate Janelle Stelson, a popular TV anchor in the area who until about a year ago was a registered Republican.
Ms. Stelson, who is running as a centrist, prevailed in a six-candidate primary that was largely upbeat and free of intraparty fisticuffs.
“I’ve had Scott Perry in my cross hairs from the moment I announced my candidacy last October,” she said in an interview.
Now, Mr. Perry, a historically lackluster fund-raiser who has had to divert substantial donations to paying for legal fees relating to his role in trying to overturn the 2020 election, finds himself increasingly at risk in a central Pennsylvania seat that the nonpartisan Cook Political Report recently shifted from “likely Republican” to “lean Republican.”
Mr. Perry’s difficulties well predate Tuesday’s primary. After spending his first eight years in near obscurity, most of that time in a solid-red district before a court-ordered redistricting in 2018, he became the wrong kind of famous after the 2020 election.
Claiming that the Democrats had cheated Mr. Trump out of victory, Mr. Perry embraced some of the cycle’s more exotic conspiracy theories, such as the groundless allegation that Mr. Trump’s C.I.A. director, Gina Haspel, worked in concert with the Italian government to flip votes to Joseph R. Biden Jr. He was also a key player in the successful push to get Mr. Trump to elevate an obscure government lawyer, Jeffrey Clark, to attorney general so that Mr. Clark could assist in trying to overturn the election results.
On Tuesday, several primary voters interviewed at polling stations throughout the district cited Mr. Perry’s backstage efforts as reason enough to unseat him. Deborah Genet, a Democrat and special education teacher in Mechanicsburg, described Mr. Perry as “an insurrectionist who believes in the Big Lie,” referring to his baseless claims about the 2020 election.
The same sentiment was echoed by a registered Republican, Mary O’Connor, who said as she departed a polling center in Camp Hill: “What Scott Perry did in the days leading up to Jan. 6 was unforgivable.” Ms. Genet added that she planned to vote for his Democratic opponent in November.
Mr. Perry has had to divert roughly $327,000 in donations over the past year toward legal fees relating to his role in the 2020 election. (Ms. Stelson has joked on the campaign trail: “It’s really hard to raise money when the F.B.I. has seized your cellphone,” referring to the bureau’s subpoena of Mr. Perry’s data.)
He enters the postprimary season with about $500,000 in cash on hand, less than any other House Republican facing a significant general election challenge. At the same time, the House Majority PAC, Democrats’ main organ for financing House races, has already reserved $2.4 million to buy TV ads in the Harrisburg, Pa., media market for the final four weeks of the election, after not investing in the district at all during the previous election cycle.
In interviews, two officials with Mr. Perry’s campaign sought to play down his vulnerabilities. A hefty campaign purse would be extraneous for a six-term incumbent in an inexpensive media market, they said. They argued that by the final weeks of the race, voters in the heavily contested state of Pennsylvania, which is also home to a competitive Senate race, will have been so thoroughly inundated by an autumnal tidal wave of presidential advertising that they will tune out ads targeting their congressman.
Anyway, Mr. Perry’s officials noted, their candidate has outperformed Mr. Trump, who carried the district in 2020 by four points, three fewer than Mr. Perry’s victory that same year.
But some observers say the numbers should be of concern for both the incumbent and his party.
“Perry’s seat is definitely creeping its way into the swing-district category,” James Lee, a Harrisburg-based pollster, said in an interview.
In 2022, Josh Shapiro, then the Democratic candidate for governor, carried Mr. Perry’s district by 12 points. This year, for the first time in more than a century, Democrats hold a majority on the county commission of Dauphin County, of which Harrisburg is the county seat.
The recent Democratic victories were driven by the swelling population of center-left suburbanites who work in the state government and in the district’s burgeoning medical community. Those same professionals tend to view Mr. Trump with disfavor, part of a national trend that may provide Mr. Biden with his best path to victory in Pennsylvania and other swing states.
Mr. Perry, who in 2022 defeated an underfunded progressive Democrat by eight points, has not adjusted his message to fit the district’s electoral trends, a fact his supporters point to as proof of a refreshing authenticity. The congressman’s TV ads and yard signs have accentuated his military career, which includes having flown 44 combat missions in Iraq and which culminated in his attaining the rank of brigadier general.
His House website also frames him as an exemplar of “hard work and dedication,” the offspring of a mother who fled an abusive partner in California and eventually relocated to a house in Dillsburg, Pa., that for a time lacked electricity or running water and required that the family live on public assistance.
Mr. Perry still lives in Dillsburg, a Republican stronghold in the district, where primary voters responded to a reporter’s queries about the incumbent’s Democratic opponents with dismissiveness or laughter.
Ms. Stelson did not spend much time campaigning there. Her advisers explained in interviews that she had been directing her efforts to the vote-rich cities and suburbs, and that outreach to the broader electorate would come later.
As an anchor for the NBC affiliate WGAL, Ms. Stelson twice moderated Mr. Perry in debates against Democratic opponents. She has pitched herself as an affable, instantly familiar TV personality and noncombative alternative to an extremist incumbent.
“I’ve known who Janelle Stelson was since 1995, when I was in high school,” said Jason O’Malley, a Lancaster-based Democratic operative who is not affiliated with her campaign. “She’s got name recognition through the roof.”
Ms. Stelson has sought advice from Edward G. Rendell, the state’s former Democratic governor, who said in an interview: “A person like Janelle, who people have been watching from their living room for so many years — she becomes like a trusted friend.”
In a campaign appearance in Harrisburg two weeks before the primary, she said of the persistent problems on America’s southern border: “Both parties have been botching it.” She also lamented the Supreme Court decision overturning Roe v. Wade but then added, “Nobody likes abortions.”
Mr. Lee, the pollster, said Ms. Stelson was wise to campaign as a centrist.
“If she is branded as a moderate female,” he said, “she will have broad appeal to voters in the district.”
Still, Ms. Stelson’s command of the issues has yet to be tested, and her opponent’s campaign has already hinted at a thorough vetting of her background.
In her victory speech in Hershey on Tuesday night, Ms. Stelson argued that it was urgent for Democrats to take back the House and vowed to do her part to “recodify Roe v. Wade.”
But she also made plain that her campaign will above all be about defining the Republican incumbent as unacceptable.
“Scott Perry,” she said. “That’s what tonight is all about.”