Loudoun County board chair Scott K. York lost his bid for reelection on Tuesday. (TRACY A WOODWARD/TWP)

Loudoun County Board Chairman Scott K. York (I) was defeated by Democrat Phyllis J. Randall on Tuesday in a three-way race, ending his two-decade career in the government of one of the nation’s richest counties.

Also swept out of office was Sterling Supervisor Eugene A. Delgaudio (R), a conservative firebrand who survived a recall effort last year.

Democrat Koran Saines, a human resources manager for Aramark, is set to replace the four-term supervisor and anti­-gay activist, who among other things has accused U.S. House Speaker Paul Ryan (R-Wis.) of being “the Homosexual Lobby’s Trojan Horse.”

But only 214 votes — about 4 percentage points -- separated the two candidates in a preliminary count, without any provisional ballots.

Sterling Supervisor Eugene A. Delgaudio (R) lost a close race to Democrat Koran T. Saines. (Tracy A. Woodward/THE WASHINGTON POST)

In the chairman’s race, Randall captured 37 percent of the vote, according to unofficial returns, to beat York, who had 30 percent, and Republican Charlie King, who had 29 percent.

A therapist who has held leadership positions on Virginia’s Fair Housing Board and Board of Corrections, Randall pledged to run a more ethical and transparent county board.

A third Democrat, Leesburg Mayor Kristen C. Umstattd, defeated Republican William A. Estrada, a home schooling lobbyist, for the Leesburg seat being vacated by Supervisor Kenneth D. Reid (R).

Together, the three victors will turn an entirely Republican board into a divided one. Randall is also the first African American elected to the county board.

The upsets cap a tumultuous year in Loudoun politics.

York announced early on that he would not run for a new term, only to reenter the race after his preferred successor, Broad Run Supervisor Shawn M. Williams (R) bowed out amid revelations about past allegations of domestic abuse.

Unwilling to accept lawyer King, the Republican nominee, York ran as an independent. Williams, meanwhile, resigned from his seat in September after being charged with assaulting a neighbor. He will be replaced by Ron Meyer, a Republican media strategist and activist who ran against Rep. Gerald E. Connolly (D) in 2014.

Meyer captured 58 percent of the vote on Tuesday, defeating AL Navarez, who had 42 percent.