Democrat Mark Herring, left, and Republican Mark Obenshain at a campaign debate in October hosted by the Loudoun County Chamber of Commerce. (Jahi Chikwendiu/The Washington Post)

— The recount of Virginia’s exceedingly tight race for attorney general will begin Dec. 16, a Richmond judge ruled Wednesday, as attorneys for the two candidates sparred over the procedures that will govern the ballot tally.

State Sen. Mark R. Herring, a Democrat from Loudoun County, edged state Sen. Mark D. Obenshain, a Harrisonburg Republican, by 165 votes out of more than 2.2 million cast, the State Board of Elections certified last week. It was the closest statewide margin in Virginia history and one that entitled Obenshain to request a recount paid for by localities.

A handful of Republicans have already raised questions about how ballots were counted across the state, particularly in enormous Fairfax County, and they said they will watch the recount even more closely for irregularities.

Virginia law allows an unsuccessful candidate to contest the result in the General Assembly, with the winner decided by a joint session of the state House and Senate — which would feature a hefty Republican majority. Obenshain’s team has not said whether it will pursue that option if he remains behind after the recount.

The recount will be overseen by a special court, and the lead judge — Beverly W. Snukals of the Richmond Circuit Court — heard from both sides Wednesday before issuing several rulings.

Fairfax, the state’s largest jurisdiction with more than 1 million residents, will begin its recount Dec. 16, and the rest of the state will start the next day. The recount court — which in addition to Snukals will include Norfolk Circuit Court Judge Junius P. Fulton III and Danville Circuit Court Judge Joseph W. Milam Jr. — will begin examining the results from localities and review challenged ballots Dec. 19 in hopes of declaring a winner by the end of that week.

Before the count, election officials across the state will race to test their equipment and make sure they’re prepared for a busy week.

“There’s going to be a lot of activity between now and Christmas, and it’s not all going to be Christmas shopping,” said Herring attorney Kevin J. Hamilton.

William H. Hurd, an attorney for Obenshain, consistently pushed Wednesday for procedures that could allow for more challenged ballots and for more ways to contest the final numbers. Hamilton wants to see the proceedings move faster and require the disclosure of less election material to the campaigns.

Although the two campaigns were able to agree on several issues before the hearing, they split on some key questions, including the role of the recount observers stationed by both campaigns in every jurisdiction to watch the ballot counting.

Hurd argued that the observers should be able to suggest to local recount officials — in most localities, the Republican chair and Democratic secretary of the electoral board — whether a ballot should be challenged and sent to Richmond for the court to review. Hamilton said that could interfere with the process and allow partisan observers to exert undue influence.

Hamilton estimated that election officials may have to hand-count as many as 100,000 ballots statewide, including “undervotes,” where no vote for attorney general was recorded, and “overvotes,” which include markings for both candidates. A high volume of challenges by election observers could lead to “a truckload” of ballots coming to the Richmond court for review.

“It’s going to be a zoo,” Hamilton said.

Hurd disagreed that there would be a huge number of ballots sent to Richmond.

“There will not be that many, but in an election this large, the ballots sent to this court may well make the difference,” Hurd said.

Attorneys also clashed over whether and how quickly the campaigns should be able to look at poll books — the electoral rolls used to check in voters at polling places. Obenshain’s team wants to see all of them as soon as possible.

“We know why they want to delay,” Hurd said. “They would like us to have as little time as possible to access these poll books.”

Both sides will prepare briefs on the unresolved issues, which will be heard by the three judges at a hearing next week.

Snukals expressed concern that when the final disputes are heard the week of Dec. 15, the two teams of attorneys could prolong the process with endless arguing.

“You all are not short-winded,” Snukals said.

Hurd said after the hearing that the recount would be “a massive undertaking” and would not say whether he expected his candidate to emerge victorious.

“It would be silly to predict the outcome of the recount one way or the other,” Hurd said. “I’ll tell you: It could go either way.”

Herring, meanwhile, told reporters Wednesday that he fully expects to be “reaffirmed” as attorney general-elect at the end of the recount and that he does not think Obenshain will contest the result in the General Assembly. Doing so, Herring said, “would be an extraordinary act that no evidence shows would be appropriate.”