By DENISE LAVOIE, Associated Press

RICHMOND, Va. (AP) — Mark Herring was fresh from his inauguration as Virginia's new attorney general in 2014 when he announced that he would not defend the state's constitutional amendment banning same-sex marriage.

Herring, a Democrat, voted in favor of the ban as a state senator in 2006, but eight years later, as attorney general, he had a change of heart.

As Herring seeks re-election, that decision has become a constant source of criticism from Herring's Republican challenger, John Adams, an opponent of same-sex marriage. But Herring says he isn't fazed, noting that his position was upheld by the U.S. Supreme Court, which struck down such bans as unconstitutional and effectively legalized gay marriage across the country.

"We were right on the law and we were right for Virginia's families," Herring told The Associated Press in a recent interview. "Standing up for people's rights is what an attorney general should be doing."

Herring says Adams, a lawyer at a powerful Richmond law firm, is "out of step with where a majority of Virginians are."

With the race between Herring and Adams the only attorney general election in the country this November, it's drawn national attention and an influx of money. Both candidates have run negative ads attacking one another, with Herring portraying Adams as a defender of money-launderers and other white-collar criminals. Adams, in turn, has sought to portray Herring as an activist crusading for his own liberal causes rather than standing up for the state's existing laws.

Herring, 56, won his first term as attorney general by a razor-thin margin, defeating Republican state Sen. Mark Obenshain in 2013 by fewer than 1,000 votes out of more than 2.2 million.

Two years later, he surprised some political observers when he announced he would seek a second term as attorney general instead of running for governor, a traditional next step for his predecessors. Some political pundits said Herring's decision was driven by the Democratic Party's desire to avoid a battle with Lt. Gov. Ralph Northam for the Democratic nomination for governor. Herring insists he simply wanted to continue the work he's done over the last four years.

"With the right person in this job, you can really help a lot of people," he said.

Herring says Adams is "fixated" on conservative social positions and is at odds with many Virginians who have increasingly progressive views on gay rights, contraception rights, gun control and other issues.

"He would use the powers of the office to try to undue that progress," Herring said.

Herring touts his efforts to reduce a backlog of untested sexual assault kits. His office secured grant money to begin testing on about 2,000 kits collected before 2014. So far, about 650 of those have been tested. A second phase of the project to test another 1,250 kits collected between 2014 and 2016 is set to begin after a laboratory contract is finalized.

He also cites his work on the opioid overdose crisis, where he pushed for getting the overdose-reversing drug naloxone to law enforcement officers around the state and for passage of a Good Samaritan law that protects people who call 911 to report an overdose.

"Mark Herring sat in my living room and talked with seven or eight addicts and their families about what was needed. He was genuinely concerned and he doesn't want this to keep happening in our state," said Carolyn Weems, whose 21-year-old daughter died of a heroin overdose in 2013.

Herring was raised by a single mother in northern Virginia. After receiving bachelor's and master's degrees from the University of Virginia, he went to the University of Richmond School of Law, then settled into a private law practice in his hometown of Leesburg. He served on the Loudoun County Board of Supervisors, then as a state senator for eight years before winning the attorney general's election in 2013.

Herring angered Republicans in 2014 by issuing a legal opinion finding that undocumented immigrants brought to the U.S. as children qualify for in-state college tuition under existing law.

Herring has also drawn criticism for giving some members of his staff pay raises made possible in part by using asset forfeiture money to pay the attorney general office's rent, vehicle maintenance and operational costs.

The Associated Press reported earlier this year that the Justice Department gave Herring's office instructions on how to work around its own rules against using asset forfeiture money for salaries or pay raises. The department suggested in a PowerPoint presentation that instead of using the money to pay for raises, agencies can use it to cover routine costs and then redirect money already budgeted for maintenance into salaries.

Earlier this month, a Republican-controlled legislative commission called for a study of Herring's office, including how it spends proceeds from asset forfeiture and an examination of salary increases.

During a recent debate with Adams, Herring dismissed the commission's actions as "election season shenanigans."