Congressman Scott Perry's fringe, far-right ideas on immigration may be contributing to his close race in a Republican-leaning Pennsylvania district.

Congressman Scott Perry (R-PA) defended Trump’s cruel family separation policy, and even lamented that children can only be detained in cages for 20 days.

His hyper-partisan extremism may have worked in the past, but Perry now finds himself in a close race with Lutheran pastor and Army veteran George Scott.

Perry formerly represented Pennsylvania’s illegally gerrymandered 4th Congressional District, which was a drawn as a safe Republican district. But now Perry is running in the newly drawn 10th Congressional District, which still leans Republican, but not as much as the other one did.

A new New York Times/Sienna College poll shows the race within the margin of error, with Perry holding just a 2-point lead over Scott, 46 percent to 44 percent. A significant 12 percent of voters are undecided, and there is a 4.7 percent margin of error.

According to FiveThirtyEight, the new district has an 11-point Republican lean, meaning it is 11 points more Republican than the nation overall. Yet Perry only has a slim two-point lead.

And Perry’s fringe positions may be keeping the race close, since his unrelenting extremism is out of touch with those he is now seeking to represent.

In their endorsement of Scott, a moderate Democrat, Penn Live described Perry as “a sharp-elbowed partisan,” and criticized him for being a “loyal conservative foot soldier of the hyperpartisan Freedom Caucus.”

Even a former Republican colleague lambasted Perry, calling him out as a partisan lawmaker who “spends too much time promoting baseless conspiracy theories and Freedom Caucus hyper-partisanship and too little time addressing the real challenges that people are facing every day.”

When Trump began separating families at the border, Perry had no qualms defending the outrageous policy. In fact, Perry even made up myths about human trafficking to defend Trump.

Democrats are trying to pick up 23 seats in the House of Representatives in order to regain the majority. Perry’s extreme agenda could help Scott pick up the seat and move the Democrats one step closer to their goal.

The Times/Sienna poll spoke to 498 likely voters between Oct. 23 and Oct. 26.