KANSAS CITY, Kan (Reuters) - Kansas Republican and state treasurer Ron Estes on Tuesday defeated Democrat civil rights attorney James Thompson to win a Congressional seat in a race that became an unlikely testing ground of an early backlash to President Donald Trump.

Estes got about 53 percent of the vote, preliminary results showed, to win the Kansas 4th congressional district seat held by Republican Mike Pompeo from 2011 until he vacated it this year, to become director of the Central Intelligence Agency.

“Even though we heard a lot from the national media and from people outside this state that we were not going to be able to win this race, we showed that we are still a Republican seat,” Estes told supporters at a rally in Wichita.

“And we’re going to make sure we change things in Washington.”

Democrats had hoped to capitalize on Trump’s poor approval rating and dissatisfaction among moderates with Republican Governor Sam Brownback to win back one of 24 seats they need nationwide to reclaim the House.

The seat, which Pompeo won with nearly 61 percent of the vote in November, looked until recently like a lock for Estes, the state treasurer since 2011.

But the race became surprisingly competitive and drove Republican leaders into a last minute push for Estes. Texas Sen. Ted Cruz, who won the Kansas caucus in the Republican presidential primary, campaigned for Estes over the weekend.

President Trump, who carried the 4th district with about 57 percent of the general election vote in 2016, also pushed for Estes, with a message on social media network Twitter expressing support for his fellow Republican earlier in the day.

The last Democrat to hold the Kansas 4th congressional district seat was Dan Glickman, who served nine terms before becoming agriculture secretary in 1995.

Thompson made the race a lot closer than people would have expected earlier this year, said his campaign manager Chris Pumpelly.

“People were writing us off the whole time,” he said. “They said it was a no-go, but we proved them all wrong. We made this race absolutely competitive and we are very proud of it.”