He served in elected office on the Loudoun County Board of Supervisors from 2000 to 2003, and was the Town Attorney for Lovettsville, Virginia, from 1992 to 1999. He is the principal with The Herring Law Firm, P.C., in Leesburg, Virginia. Herring was elected to the Senate of Virginia in a special election triggered by two-term incumbent Republican Bill Mims' appointment as chief deputy attorney general of Virginia. He was re-elected to a full term in the 2007 election, and re-elected again in 2011. On July 24, 2012, he announced that he would run for the office of Attorney General of Virginia, in the 2013 elections. On April 2, 2013, The Democratic Party of Virginia certified that Herring's name would appear on the June primary ballot. On June 11, 2013, Herring won the primary.
Attorney General of Virginia
2013 election
Herring faced Justin Fairfax in the Democratic primary in June 2013, winning narrowly by a margin of 52%-48%. He faced Republican Mark Obenshain in the general election. On the night of the election, Obenshain held a 1,200 vote lead over Herring. Vote totals fluctuated as ballots were canvassed in the following days, and the race remained too close to call. On November 12, 2013, with all ballots counted, Herring held a 165-vote lead, or less than 0.01%, and Obenshain requested a recount. Herring's total increased during the recount, so Obenshain conceded the election on December 18, 2013, and later that day, the recount ended with Herring winning by 907 votes, or 0.04%. Herring was sworn into office on January 11, 2014.
On January 23, 2014, Herring announced that he would not defend the Virginia Marriage Amendment in federal court, and filed a brief in a federal lawsuit being brought against the law asking for it to be struck down. Herring said in a press conference announcing the move, "I believe the freedom to marry is a fundamental right and I intend to ensure that Virginia is on the right side of history and the right side of the law." Reaction to the announcement was mainly along party lines, with Democrats mostly praising the move and Republicans mostly criticizing it as a violation of his oath of office. The National Organization for Marriage has called for Herring's impeachment, claiming that the Virginia attorney general is obligated to defend all state laws against challenges. In the press conference, Herring said, "There are those who will say that the attorney general is required to defend every challenge to a state law, even a law that is unconstitutional. They could not be more wrong." The amendment was ruled unconstitutional by the U.S. District Court in Norfolk in the case Bostic v. Schaefer on February 13, 2014. On July 28, 2014, the Fourth Circuit Court of Appeals issued a 2–1 opinion upholding the lower court's decision. This was appealed to the Supreme Court of the United States, which denied a writ of certiorari, letting the Fourth Circuit Court's decision stand and legalizing same-sex marriage in Virginia.
Herring faced no opposition in the Democratic primary and won his party's endorsement for re-election. He is the first Virginia Attorney General to run for reelection since Mary Sue Terry in 1989. He defeated Republican opponent John Donley Adams and won re-election. His former opponent and fellow lawyer Justin Fairfax won the race for Lieutenant Governor of Virginia in the same year.
Blackface controversy
A few days after the controversy began over a blackface picture appearing on Ralph Northam's page in a 1984 medical school yearbook in the context of the 2019 Virginia political crisis, Herring admitted to an incident in which he also wore blackface: Herring had previously called on Northam to resign after the discovery of Northam's yearbook page, saying, "It is no longer possible for Governor Northam to lead our Commonwealth, and it is time for him to step down." He later clarified that the discovery of the yearbook page was not the reason he called for Northam's resignation; he did so because Northam had initially admitted to appearing in the photo, but the following day, "came out with a different and contradictory account, and that was when there was an erosion of trust."