The special election was called because Trump had asked the district's previous representative, Mike Pompeo, a Republican, to become Central Intelligence Agency director. It's true that late polling had Estes underperforming, having dropped into a virtual tie with Thompson with just a +1 edge.

- Only one Democratic-held district gave Trump more of its vote - (Minnesota Rep. Collin C. Peterson's district, which gave Trump 62 percent).

In Cowley County, Estes received 3,179 votes or 56 percent of the vote to 2,422 votes or 43 percent for Thompson.

Chapman Rackaway, a political science professor at Fort Hays State University, told the Wichita Eagle that Kansas "Democrats are fired up and they're mobilizing". And that in turn leaves him and a Republican Congress, without many victories to call home about next November.

We need to keep paying attention to special elections across the country, and progressives should not dismiss races that are in traditionally Republican areas. However, in the days leading up to the election, the Republican establishment was doing everything possible to pull him over the finish line.

In the campaign's final weekend, the NRCC spent close to $100,000 on the race, and the GOP-allied Congressional Leadership Fund super PAC paid for tens of thousands of get-out-the-vote phone calls.

The contest showed the massive shift in the electorate since voters elected Donald Trump President in November. Altmiller, an unaffiliated voter, cast his ballot for Thompson. Ted Cruz who came to Wichita to campaign for Estes the day before a special election at Yingling Aviation, Monday, April 10, 2017, in Wichita, Kan.

The civil rights attorney said he was inspired by Sen. Bernie Sanders' 2016 presidential campaign. Perhaps emboldened by this as the election approached, Thompson openly embraced support from a group that Sen.

Kansas GOP Treasury Secretary Bob Estes defeated Democratic newcomer James Thompson by more than 8,000 votes and almost 7 percentage points. Also in 2016, Trump won the district by 27 points.

Estes won his spot by less than 7 percent.

In a sign of concern for Republicans, Thompson edged Estes in the district's most populous county surrounding Wichita, a county Trump won by 18 points last November.

"I wanted to run in 2018 one way or the other", he said. "And we've shown that this district is not just competitive but that we can win it", Thompson said.

Analysts say Libertarian candidate Chris Rockhold's bid for public office was a long-shot.

"James made this election far closer than any pundit predicted", Gibson said. Mike Pompeo was re-elected with 60 percent of the vote and served until President Trump tapped Pompeo to become CIA Director.

A Democrat hasn't represented the state's 4th District since Dan Glickman was replaced in 1994.

President Donald Trump passed the first test of his ability to hold a Republican majority in Congress Tuesday night when the GOP held off a strong challenger in a special election.

Seen through that lens, Thompson's 7-point loss should have Republicans across the country very anxious.

Trump tweeted his support for the Republican candidate on Tuesday as voters were casting ballots.

All of which leads us to conclude that there are national factors that spurred Thompson's surprisingly close loss.