Rep. Tim HuelskampTimothy (Tim) Alan HuelskampEmails show climate change skeptics tout ‘winning’ under Trump Trump administration's reforms could make welfare work again Bipartisan 'No Labels' group aims to protect moderates in primary fights MORE (R-Kan.) defeated primary challenger Alan LaPolice on Tuesday night, but posted a smaller than expected margin after largely ignoring the challenge for much of the race.

Huelskamp took 54 percent of the vote to LaPolice’s 46 percent when the race was called, with 82 percent of precincts reporting.

The congressman has strong Tea Party support, so his primary challenge hinged not on his conservative credentials but rather what was seen as a lack of support for agricultural interests in his district.

He supported a measure that would essentially eliminate government subsidies for biofuels — a major boon to farmers in the 1st District, which is home to 11 biofuel plants, according to The Associated Press. That move drew him opposition from a number of major agricultural groups, and a challenge from farmer LaPolice.

Huelskamp opponents were hoping for a last-minute break in LaPolice’s favor, and a group that ran ads against him released a one-day poll last month that showed LaPolice closing Huelskamp’s lead to just 21 points.

Early on Tuesday, that improbable scenario seemed to be playing out, as early returns from Kansas’s 1st District showed a tight race. Indeed, Huelskamp’s 8-point lead was tighter than expected, and continues a trend of incumbents surviving primary challenges but with markedly slim margins.

The outcome is particularly notable because of Huelskamp’s cash advantage — as of July 16, he had about $807,000 in the bank to LaPolice’s $36,6000.

But neither spent much in the first two weeks of July: thee challenger less than $10,000, and Huelskamp under $50,000. That may in part explain LaPolice’s surprisingly strong performance — like other incumbents who also posted slimmer-than-expected win margins, Huelskamp didn’t spend much against him and launched no semblance of an aggressive strategy to hedge his bets against a challenge that was, by all accounts, a long-shot.