Democrat Mark Herring, left, and Republican Mark Obenshain participate in an October campaign debate during the Virginia attorney general race. (Jahi Chikwendiu/Washington Post)

State Sen. Mark D. Obenshain (R) conceded the race for Virginia attorney general to Democrat Mark R. Herring on Wednesday, bringing the election to a belated end and giving Democrats a sweep of statewide offices — but throwing control of the state Senate into question.

The move allowed Herring to claim victory for the third time since Nov. 5 in a contest that on election night was the closest statewide race in Virginia history. It also spared a three-judge panel in Richmond from having to continue slogging through more than 100 ballots that one side or the other had challenged.

And for the first time since Election Day, speculation in Virginia political circles shifted from who would succeed Attorney General Ken Cuccinelli II (R) to how differently the new attorney general would lead.

Herring spent much of the campaign promising not to run the state’s law firm like Cuccinelli, a social conservative who waged high-profile battles against a climate scientist, “Obamacare” and universities with policies that protect gay people from discrimination.

“Virginians are looking for mainstream leadership,” Herring, a state senator from Loudoun County, said during an afternoon news conference in the Capitol on Wednesday. “They want good jobs. They want better education for their children. They want a good transportation system that will serve our growing economy.”

Obenshain conceded defeat after Herring’s attorney announced that his client’s narrow lead had grown to more than 800 in a statewide recount that began Monday and was scheduled to finish Wednesday.

That lead apparently grew even more after Obenshain’s concession. Although the recount court had not issued its official order as of 9 p.m. Wednesday, Herring attorney Marc E. Elias said the final results showed the Democrat winning the race by 907 votes.

“It’s apparent that our campaign is going to come up a few votes short,” Obenshain told reporters at an afternoon news conference on Richmond’s Capitol Square. Obenshain said he called his opponent to concede and offer his support as Herring prepares to assume office and added that he will continue to fight for conservative principles. But he also said that governing is “about reaching common ground.”

He choked up as he reflected on all the time he and his 22-year-old daughter, Tucker, spent together on the campaign trail. She was his driver and also starred in a well-received TV ad.

“The campaign car that we bought last November, that Tucker drove for the better part of the past year, flipped 100,000 miles today on our way to Richmond,” he said. “I joked with people during the course of the campaign that that’s a lot of father-daughter time. And she’d probably confess there is such a thing as too much father-daughter time. But I’ll tell you, from this dad’s perspective, it’s a gift from God, and I’m immensely grateful for that time.”

Obenshain was seeking the office that his late father, Richard Obenshain, sought unsuccessfully in 1969. The elder Obenshain died in a plane crash while campaigning as the GOP’s U.S. Senate nominee in 1978.

Republicans have raised questions about whether Herring, who supports same-sex marriage, would defend the state constitutional amendment that bans it.

“The Attorney General has a constitutional and statutory obligation to enforce and defend the laws and Constitution of the Commonwealth,” House Speaker William J. Howell (R-Stafford) said in a written statement that also congratulated Herring on his win. “This is not an obligation that can be taken lightly.”

When asked at his news conference whether he would defend the marriage amendment, Herring declined to comment, noting that he will not take office until Jan. 11 and that there is only “one attorney general at a time.” When pressed, he said he intends to honor a campaign pledge to advise colleges and universities that, contrary to Cuccinelli’s stance, they have the authority to protect gays with anti-discrimination policies.

The conclusion of the race was a relief to politicians from both parties, some of whom feared that it could drag on past the recount and into a politically charged “contest” before the General Assembly. Under a little-known state law, the loser of a recount may ask legislators to decide an election or even call a new one. Such a request would need to be premised on alleged voting irregularities. Obenshain’s team had raised questions about how some ballots had been handled in Fairfax County and recently indicated in court that it was at least considering the option of a contest.

But there were still loose ends to be tied up in the attorney general’s race, as the results from the recount continued to be tabulated into a statewide total.

And then there is the matter of the Senate, which has been evenly split. Herring’s win will prompt a special election, as there will be to replace Sen. Ralph Northam (D-Norfolk), who won the race for lieutenant governor. Because Herring’s district is seen as highly competitive, his victory could cause Democrats to lose power in the evenly divided Senate. The GOP has a wide margin in the House. Herring’s win seals his party’s sweep of three statewide offices this year, the first for Democrats in nearly a quarter-century. He will join Gov.-elect Terry McAuliffe and Northam.

In late November, the State Board of Elections declared Herring the winner by 165 votes out of more than 2.2 million cast, a margin so slim it entitled Obenshain to a government-paid recount.

Obenshain’s decision came a day after Herring’s lead grew to more than 810 votes, with 73 percent of ballots across the state recounted, according to figures Herring’s campaign released the night before.

Fewer than 120 ballots had been “challenged,” the campaign said, meaning recount officials could not agree on how they should be counted. They forwarded the ballots to a special recount court in Richmond that began its work Wednesday.

Before Obenshain announced that he was conceding the race, attorneys for the two sides spent roughly 90 minutes in a Richmond courtroom arguing over the “challenged” ballots in front of the three-judge panel. It was painstaking work, as the judges sought to divine the intent of voters who’d taken creative approaches to filling out their ballots. Some filled in the oval next to a candidate’s name and also put a name on the “write-in” line. One filled out the ovals next to both Obenshain and Herring but then wrote, “No, wrong candidate” at Obenshain’s name.

Another voter decided to ignore the ovals and fill in the “D” next to Herring and every other Democratic candidate.

“Every ballot tells a story,” Elias said.

In the end, the arguments over those ballots were moot, as the two sides withdrew their challenges once Obenshain had given up.

It was then left to the State Board of Elections team working in the basement of the Richmond courthouse to finish tallying the results sent in by every locality and present them to the judges, who were expected to issue an order with the final results of the recount Wednesday night.