Updated at 8:20 a.m. Wednesday with a comment from Vic Cunningham.

Dallas attorney J.J. Koch eked out a win for the Republican nomination for Dallas County commissioner, beating Vickers "Vic" Cunningham, a former judge who drew national headlines over alleged racist behavior and language.

Twenty-five votes decided the race for northern Dallas County's District 2 seat.

"That was totally bonkers," Koch said. "To say that this race was contentious is an understatement. To say that the last four days were bad for the Republican party is an understatement."

On Friday, the last day of early voting, Cunningham admitted to rewarding his kids financially if they marry a white, heterosexual, Christian person in a story that reverberated nationally after it was published by The Dallas Morning News.

Cunningham, who held a 10-percent lead over Koch in early voting, conceded the loss in a Facebook post on Wednesday.

"Unfortunately we did not prevail," Cunningham said. "I am acutely aware of my own failings and will counsel with my God, my family, and my friends what path I shall take moving forward."

Cunningham, 56, who served as a criminal court judge for 10 years, was the less controversial of the two candidates for much of the race -- until his estranged brother, Bill, showed up at The News on May 14 and alleged his brother was a longtime bigot who regularly used the N-word and the term "boy" to insult black people behind their backs.

Cunningham denied harboring racial bigotry but did confirm one of his brother's primary allegations -- that his trust fund for his kids includes a stipulation intended to discourage a child from marrying a person of another race or of the same sex.

"I strongly support traditional family values," Cunningham said. "If you marry a person of the opposite sex that's Caucasian, that's Christian, they will get a distribution."

Throughout the race, Koch, 38, did not shy from controversy. His combativeness cost him the support of some leaders, including the district's longtime Commissioner Mike Cantrell, who feared Koch would struggle to compromise with the four Democrats on the Commissioners Court.

Koch launched a legal fight against the county elections head. He blamed "illegal immigrants" for the county's shrinking middle class, angering Commissioner Elba Garcia. And he said that as a former college wrestler, he'd be able to whup any of the four Democrats he'd work with on the Commissioners Court.

Earlier in the race, Cunningham accused Koch of committing attempted bribery by offering to pay another candidate, former Garland City Council member Stephen Stanley, to drop out of the race. Koch admitted to making the offer, but said he didn't consider it a bribe because he was trying to be nice and he'd heard Stanley had money problems and planned to exit anyway.

Koch said Monday prior to the runoff that he had long known about the allegations that Cunningham harbored racist views, but he didn't have proof.

"I've had to eat this poop sandwich on this bribery allegation stuff, while he has no leg to stand on," Koch said Monday. "He's a horrible human being."

After The News article, the Republican Party condemned "both the behavior and language that was used by Vic Cunningham." The party adopted a resolution Monday denouncing racism, and according to Koch, declined to vote on another resolution that called for Cunningham to withdraw from the race "to spare the Republicans of Dallas County the shame and humiliation."

A former political aide of Cunningham's described him making repeated racist statements. A text message from Cunningham's son showed concern that his father would not accept his relationship with an Asian woman. And in a recorded conversation, Cunningham's mother, Mina Cunningham, acknowledged her son had been a longtime bigot.

When contacted by The News, however, Cunningham's son and mother defended him, saying he is not a racist.

Former state district judge Vickers Cunningham is running in the Republican Party primary to replace the retiring Mike Cantrell in District 2 of the Dallas County Commissioners Court. Bill Cunningham and his husband Demonse Williams say that Cunningham's brother is racist and homophobic. Cunningham and Williams were photographed at their Dallas home Thursday May 17, 2018. (Andy Jacobsohn / Staff Photographer)

Amanda Tackett, a former D Magazine writer and friend of Bill Cunningham's who worked on Vic Cunningham's 2006 campaign for district attorney, said she heard the former judge repeatedly use the N-word. She said he described criminal cases involving black people as "T.N.D.s," short for "Typical [N-word] Deals."

Vic Cunningham dismissed Tackett as having little involvement in his campaign and as someone who is close to his brother Bill. Asked by The News if he's ever used the N-word, Vic Cunningham paused for nine seconds before saying no.

Dallas attorney J.J. Koch running for the Republican nomination for Dallas County commissioner in District 2 answers questions in an editorial board meeting at The Dallas Morning News in Dallas on Friday, February 9, 2018. (Vernon Bryant/The Dallas Morning News) (Vernon Bryant / Staff Photographer)

The Republican nominee will face off against Democrat Wini Cannon, 63, a former municipal judge, and Libertarian Alberto Perez, 39, in the November general election. District 2 covers North Dallas, Highland Park, Farmers Branch, Rowlett, Richardson and Addison.