Democratic incumbent Mark Herring has won Virginia's attorney general race, beating back a challenge from Republican John Adams.

Herring won his second term Tuesday.

During the campaign, Herring was sharply criticized by Adams for his refusal to defend Virginia's 2006 constitutional amendment banning same-sex marriage. Herring said his position was vindicated by the U.S. Supreme Court's ruling striking down same-sex marriage bans as unconstitutional.

The race was the only attorney general contest in the country this year and drew national interest.

RELATED: Election results

Previously he served in the state Senate. He represented the 33rd district which included parts of Fairfax and Loudoun counties. He was also elected to the Loudoun County Board of Supervisors from 2000-2003.

He ran against Republican John Adams, a commissioned officer in the U.S. Navy, who served two tours of duty.

RELATED: Voters talk taxes, Trump in Virginia