Kansas Secretary of State Kris Kobach (R) rode a late endorsement from President Trump to the slimmest of leads in his state’s gubernatorial primary, setting up a potentially drawn-out fight over who won and boosting Democrats’ chances at seriously contesting the seat this fall.

Kobach, a notorious immigration hardliner and fierce proponent of the unfounded theory that there’s widespread voting fraud, held a 191-vote lead over Kansas Gov. Jeff Colyer (R) after all election day votes were finally tallied Wednesday morning, out of more than 300,000 total votes counted. That’s a 40.6 percent to 40.5 percent edge, close enough that thousands of provisional and absentee votes could make the difference — and close enough that a recount appears likely.

Colyer had a slight edge for much of the race, according to public and private polls, and Trump’s Monday endorsement may have made the difference for Kobach, his ardent supporter. Kobach has authored a number of restrictive anti-immigration and voter identification bills for states around the country, and led Trump’s widely criticized Voter Fraud Panel, which failed to turn up any evidence supporting Trump’s claim that millions of people voted illegally in the 2016 election.

A Kobach win would Democrats a shot at swiping a governor’s mansion in the heavily Republican state, given his lightning-rod positions. There’s been scant public polling of the race, but one semi-recent survey from a GOP firm found him and Kansas state Sen. Laura Kelly (D) tied in the hypothetical race, while Colyer held a double-digit lead over her.

Kansas’ divide between moderate and conservative Republicans runs deep, and Democrats have won here before with a coalition of moderates and Democrats when the GOP has nominated hardliners — most recently with former Gov. Kathleen Sebelius (D) in 2002 and 2006. The party also almost beat Kansas Gov. Sam Brownback (R) in 2014, riding voters’ fury over Brownback’s deep tax cuts and the ensuing budget chaos in the state and falling just four points short in the GOP wave year. Colyer was Brownback’s lieutenant governor, and ascended to the governor’s mansion when Brownback was picked for an ambassadorship in the Trump administration.

If Colyer pulls out this close primary, it would be good news for Republicans hoping to hold the seat, though it would be an embarrassment for the president.

This general election will be complicated by Greg Orman, a well-known and self-funding independent candidate who could siphon off votes from Kelly. But this race is one to watch heading into the fall.

If Kobach hangs on that could also help down-ticket Democrats, who are gunning to take down Rep. Kevin Yoder (R-KS) in the state’s most moderate and suburban district (Hillary Clinton carried it last election) and want to seriously contest a rural seat held by retiring Rep. Lynn Jenkins (R-KS).