Updated

Kansas Secretary of State Kris Kobach on Friday said he is recusing himself from serving as the state’s chief elections official as he clings to a razor-thin margin in the state’s Republican gubernatorial primary.

According to The Associated Press, Kobach leads incumbent Republican Gov. Jeff Colyer by 241 votes out of more than 311,000 cast.

Colyer has accused Kobach of giving county election officials guidance "not consistent with Kansas law," and said Friday on Fox News that he was worried that some mail-in ballots were not being counted as required.

Kobach said in a letter to Colyer that he was turning his election duties over to his top deputy.

"Although I would discharge my duties ethically, impartially, and responsibly, I have carefully considered your request and have decided that it is in the best interest of the citizens of Kansas that I permit another to perform the duties of the secretary of state until the conclusion of the 2018 primary election process," Kobach wrote.

TRUMP-BACKED KRIS KOBACH CLAIMS 'TENTATIVE VICTORY'

Under state law, mail-in ballots are counted if they were postmarked Tuesday and arrive in county election offices by Friday. The secretary of state's office was updating vote totals as it received new numbers from individual counties.

Kobach is a conservative lightning rod who alienates even some fellow Republicans, but he is perhaps President Donald Trump's closest political ally in Kansas and had Trump's tweeted endorsement. Colyer, backed by the National Rifle Association and a strong abortion opponent, is trying to avoid becoming the first Kansas governor to lose a primary since 1956. The winner will face Democratic State Sen. Laura Kelly, of Topeka, in the November general election.

The state's Democratic nomination went to state Sen. Laura Kelly, who defeated four other candidates in the primary. The 68-year-old has served 14 years in the Kansas Senate and is the top Democrat on the budget committee.

Fox News currently rates the race as “lean Republican.”

The Associated Press contributed to this report.