Receive the latest politics updates in your inbox

A statewide recount has finally ended the nail-biting race for Virginia attorney general, giving Democrats their first top-of-the-ticket sweep since 1989 in a state that once was reliably red.

Democratic state Sen. Mark Herring emerged the victor Wednesday with the recount adding hundreds of votes to his column.

Herring had initially led Republican state Sen. Mark Obenshain by a mere 165 votes among more than 2.2 million ballots cast on Nov. 5. On the third day of the recount, trailing Herring by 866 votes, Obenshain conceded. It was the closest statewide race in modern Virginia political history. The final vote should be certified by week's end.

"It is a bit delayed but for us the win is just as sweet and it feels great,'' said Herring, who represents a district in Loudoun County in northern Virginia. He joked that friends have begun calling him "landslide Herring.''

Obenshain conceded as the recount made it clear that Herring's lead was insurmountable, even though challenged ballots were still being decided by a three judge recount court.

"It's been a vigorous and hard-fought campaign but it's over,'' Obenshain said at a news conference.

Herring will succeed Republican Attorney General Ken Cuccinelli, who ran unsuccessfully for governor and was a conservative activist on social issues. He attempted to block the nation's new health care law, for example, and took on a climate scientist. Cuccinelli is a climate change skeptic.

Asked what the Democrat sweep signifies, Herring said, "I think what it shows is that Virginians are looking for mainstream leadership and they're looking to have leadership in our state government that is focused on the issues that are the most concern to Virginia.''

Herring identified those issues as better education and a good transportation system to support a growing economy.

In the recount, Herring's edge widened as ballots that did not register on optical scanning machines were examined by hand and the votes added to both men's column. Votes typically aren't scanned and counted if a voter wrote in the candidate's name rather than filled in a box.

Attorneys for Obenshain had signaled they would seek a contested election if Obenshain had closed the gap in the recount. That allows a losing candidate to take the election to the General Assembly, provided he can prove evidence of voting irregularities. The majority Republican legislature would have met in rare joint session to decide whether to declare Obenshain the winner or schedule a new election.

A so-called contested election would have been a politically divisive start for Democratic Gov.-elect Terry McAuliffe, who has preached partisan peace ahead of his inauguration Jan. 11.

Attorney William Hurd, who had represented Obenshain before the recount court, said simply, "We needed to find more votes than we did.''

Obenshain, who represents the Harrisonburg area, said his supporters had encouraged him to pursue suspected election irregularities. Republican attorneys had protested the handling of some ballots in Fairfax County, the state's most populous county and a stronghold for Herring.

"Today is not the time to contest the process or question results,'' said Obenshain, flanked by his wife and daughter. ``Our goal since election day was to ensure we got an accurate result in this election.''

Obenshain said he would continue to pursue his conservative agenda, included a limited government. He also vowed to work on a bipartisan basis, although he complained about the "negative'' campaign and left out moderate and liberal Democrats when he said he would work across party lines.

"I'll continue to reach out to Republicans, independents and conservative Democrats in order to find common ground in pursuing those goals,'' he said. He declined to take questions after his news conference.

Obenshain was the GOP's only hope of avoiding a Democratic sweep of the top three statewide offices after McAuliffe won and state Sen. Ralph Northam was elected lieutenant governor.

The last Democratic sweep of Virginia's top offices was when L. Douglas Wilder headed the party's ticket and was elected governor in 1989.

As attorney general, Herring will supervise more than 400 lawyers and support staff. The position also is historically a stepping stone to a run for governor.

In the campaign, Herring sought to portray Obenshain as a Cuccinelli clone who would pursue an extreme social agenda if elected. Herring, unlike Obenshain and Cuccinelli, supports abortion rights and gay marriage. He also has been an advocate of tighter gun restrictions.

Herring will depart from a state Senate that is now evenly divided - 20 Republicans and 20 Democrats.