PostTV’s “In Play” looks at how a recount in the Virginia attorney general race would work and when it might end. (The Washington Post)

Democratic state Sen. Mark R. Herring took the lead in the extraordinarily tight Virginia attorney general race Monday evening, after he picked up more than 100 previously uncounted votes in Richmond.

Herring had started the day trailing his Republican opponent, state Sen. Mark D. Obenshain (Harrisonburg), by a mere 17 votes out of 2.2 million cast. But as jurisdictions across the state continued to scrub their vote counts, the State Board of Elections showed Herring with a 117-vote lead late Monday.

Lawyers from both parties have descended on elections offices in Fairfax County and Richmond. Meanwhile, the campaigns said they were cautiously optimistic but were bracing for a long, drawn-out battle, which appears almost certainly headed to a recount and could seesaw again.

“We’re always excited to see the movement go to our favor, and we’re just going to make sure over the next few weeks and however long this plays out that every single vote counts,” said Ashley Bauman, press secretary for the Democratic Party of Virginia. “Because I think in the end, we feel confident that our candidate will be on the winning side.”

The razor-thin margin between the two candidates, a small fraction of 1 percent on Monday, has brought new urgency to the normally mundane process of accounting for all votes cast in the statewide elections.

Democrat Mark Herring, left, and Republican Mark Obenshain participate in a campaign debate hosted by the Loudoun County Chamber of Commerce at the National Conference Center on Oct. 2 in Leesburg. (Jahi Chikwendiu/The Washington Post)

In Richmond, city election officials found more than 200 votes in the attorney general’s race that had gone uncounted on election night, most of them from a single voting machine.

Herring (Loudoun) took the bulk of those votes, which also included a handful of previously overlooked paper ballots, netting a 132-vote boost to his side.

But an attorney for Obenshain’s campaign pressed the board at the end of its two-hour meeting to provide data from the electronic poll books used to check in voters when they arrived at voting places — a move that officials said would require a court order.

“What we’re trying to do for poll books is just be sure that the ledger matches, that there’s just as many votes as there are voters,” said Republican Party of Virginia spokesman Garren Shipley. “That has to balance out. There’s some places that just statistically don’t quite look right to us. We want to be careful, we want to go through it with a fine-tooth comb and just be sure.”

Registrar Kirk Showalter said the adjustments to the vote totals were typical of any election, but these had drawn unusual interest because of the nature of the attorney general’s race.

The review drew four TV cameras and about 25 observers to the registrar’s office in Richmond’s City Hall. They crammed into the office foyer and spilled into the hallway as the three-member board and Showalter counted and recounted the votes from those precincts.

“The process that you’ve just seen today is absolutely typical of what we go through in every election,” Showalter said. “I think there’s particular attention because, as I understand it, the votes are so close.”

Local jurisdictions have until midnight on Tuesday to report their results to the State Board of Elections. The state then is scheduled to certify the results on Nov. 25. If the margin is less than 1 percent, either candidate can request a recount. If the margin is less than 0.5 percent, the state will pay for the recount.

The Herring-Obenshain contest appears to be one of the closest in state history and could come down to the counting of provisional ballots. The closest, at least in modern times, was in 2005, when then-Del. Robert F. McDonnell (R) beat state Sen. R. Creigh Deeds (D-Bath) by just 360 votes in the attorney general’s race.

In Fairfax County, elections officials on Monday were trying to verify the 493 provisional ballots that were cast. Since Friday, 136 voters who voted provisionally have shown up at the government center to make their vote count.

By Monday evening, the Fairfax County electoral board had approved 172 provisional ballots and rejected 138 of them. The remaining 183 were to be verified by Tuesday afternoon. The board agreed to petition a Circuit Court judge to validate another provisional ballot that they say was handled erroneously on Election Day.

Representatives from both campaigns had been vigorously reaching out to those who had voted by provisional ballots, urging them to come to the county government center to lobby for their votes to count.

“I was afraid my phone was going to blow up if I didn’t come,” said Antonia Paris, 22, who said she had received calls from each campaign, sometimes several times in less than an hour.

Paris had to vote with a provisional ballot because she forgot to change her absentee voter status after moving back to Virginia from Germany, where she briefly studied, she said.

The pivotal role that provisional ballots can play in the final outcome “is extremely rare,” said Dave Wasserman, an editor at the nonpartisan Cook Political Report who has been closely monitoring the attorney general’s race. “Provisional ballots only tend to make the difference in a decision for local elections, where a race has been decided by 1 or 2 votes.”