With Republican state Sen. Mark D. Obenshain holding the slimmest lead — less than 500 votes — over Democratic state Sen. Mark Herring to become attorney general, the race is likely headed for a recount.

That means, it would be weeks before Virginians are certain who will be the state’s top lawyer.

Virginia has specific procedures for any recount.

First, there is no such thing as an automatic recount. Under Virginia law, a loser in a tight race may request a recount within 10 days after the state Board of Elections certifies the results. That won’t happen until Nov. 25 — after each county and city canvasses and certifies its own results.

For a recount to occur, the margin of victory must be less than one percentage point of the total vote. The candidate must pay for the recount unless the margin is less than 0.5 percent. In the attorney general’s race, the margin is way less than that, so if the results hold after certification, the state would pay for the recount.

Interactive map

See the graphic »

A three judge panel of the Richmond Circuit Court oversees the efforts and irons out the specifics, and a final recount could take weeks.

After the 2005 election, a recount determined that Virginia Governor Robert F. “Bob” McDonnell (Virginia Beach), then running for attorney general, had narrowly defeated his Democratic opponent Sen. R. Creigh Deeds (Bath).

The final result, which came about six weeks later, determined that only 360 votes separated the two men out of 1.94 million cast.

After the 1989 gubernatorial election, a recount confirmed Democrat L. Douglas Wilder’s victory over J. Marshall Coleman.