OKLAHOMA CITY — An Oklahoma congressional candidate who demanded a recount after he lost a primary runoff election by just 40 votes dropped his fight Wednesday.

Oklahoma election officials said Democrat Tom Guild asked that the recount be halted in the Democratic runoff for Oklahoma’s 5th Congressional District. The seat has been in GOP hands since 1975.

Guild sought the recount after the Aug. 23 election had him trailing former state Sen. Al McAffrey by 40 votes out of more than 16,000 cast. The recount began on Tuesday, state Election Board spokesman Bryan Dean said.

Dean said Guild requested the recount be stopped after he lost three votes in the partial recount and McAffrey picked up one. Election officials had finished counting absentee ballots as well as ballots cast in 151 precincts. Ballots from another 86 precincts remained to be counted.

The final results will be certified Thursday.

Guild, a retired university professor, said he decided to end the recount after most of the ballots had been counted and there was no significant change.

“I felt that it was not reasonably likely that we were going to gain the votes that we needed,” he said.

Guild said he has no plans to endorse anyone in the race.

McAffrey will face Republican U.S. Rep. Steve Russell, who’s seeking a second two-year term, and Libertarian Zachary Knight in the Nov. 8 general election.

“Now we’re in the process of going against Mr. Russell and winning this election,” McAffrey said after the recall was halted.

McAffrey also defeated Guild in the 2014 Democratic primary before losing to Russell in the general election.