John S. Gray, left, won the Republican primary against Prince William County Supervisor Martin E. Nohe (Coles), right, for chairman of the county board of supervisors. (JenniferLynn Studios, Martin E. Nohe)

The more conservative of two Republican candidates prevailed Saturday in a primary battle to replace Corey A. Stewart as chair of the Board of Supervisors in Prince William County, a Washington exurb where Republicans are trying to maintain their grip amid demographic changes that favor Democrats.

Supervisor Martin E. Nohe (R-Coles) lost to John S. Gray, an accountant who followed Stewart’s hard-line conservative playbook, casting the election as a referendum on “criminal aliens” in the county and a “radical social agenda” in local schools. Gray received 57 percent of the canvas vote, Nohe 43 percent.

Stewart (R-At Large) announced he would not seek a fourth term as board chairman after losing his race for U.S. Senate in the fall against Sen. Tim Kaine (D).

Nohe had said he wanted to position Prince William to take advantage of the pending arrival of Amazon in Northern Virginia by attracting more high-tech companies. (Amazon founder and chief executive Jeff Bezos owns The Washington Post.) Nohe supported a county bond referendum to fund roads and parks that Gray opposed and that is expected to be put before voters in the fall.

Gray did not respond to a call for comment.

Nohe said he was proud of the positive campaign he ran. “Unfortunately, it didn’t generate quite enough votes to win,” he said.

In the general election, Gray will face Democrat Ann Wheeler, a former energy consultant who plans to include public school funding as a campaign issue.

Many Republicans have said their 6-2 majority on the county board is in jeopardy after a blue tide in 2017 — centered largely in Prince William — brought 15 new Democrats to the House of Delegates.

Wheeler congratulated Gray on his victory and said she hoped he would join her for debates this summer so voters could compare the candidates. She said the GOP offers far-right ideology, while she would bring inclusivity.

The legitimacy of another contest Saturday was in dispute. Hanover County Supervisor Scott Wyatt claimed victory in his primary challenge against Del. Christopher K. Peace (R-Hanover) for his seat representing a district northeast of Richmond. But Peace dismissed the event as a “pretend convention” and “political stunt.”

“My campaign will continue to engage with voters across the 97th District and earn the legitimate Republican nomination on June 1st,” Peace said in a statement.

Peace supporters had pushed through a legislative district committee vote to cancel plans for Saturday’s convention, looking instead to hold a firehouse primary election in June, which they said would draw a larger turnout. The committee chairman, Tom Miller, overruled the decision, allowing the convention to go forward. But the state party has said Miller lacked authority to make that decision.

“Today, we begin to share our message of limited government with the voters of King William, New Kent and Hanover,” Wyatt said in a statement Saturday presenting himself as the party’s nominee.

Legislative district committee officials intend to notify state elections officials that Wyatt is the nominee, while state GOP Chairman Jack Wilson says he will not recognize the result as a valid nomination. It’s not clear how the dispute will be resolved.

Wyatt has assailed Peace over his vote for Medicaid expansion last year. He was among 19 Republicans to vote for the expansion, defending it as a conservative version of “Medicaid reform” because it also called for work requirements. Conservative critics say the requirements are unenforceable.

The outcomes of the nomination battles will influence the GOP’s direction in the fall as the party seeks to hold its slim majority in the General Assembly and fend off strong challenges from Democrats in local races.

Laura Vozzella contributed to this report.