Virginia Attorney General Mark Herring (D), left, and Republican challenger John Adams. (Reuters and Bill O’Leary/The Washington Post)

The low-visibility Virginia attorney general’s race is increasingly heated, as the Republican and Democrat push out ads attacking each other just days ahead of their second and final debate.

Incumbent Mark Herring, a Democrat, and his Republican challenger John Adams occupy opposite ends of the political spectrum, and their ads reflect their partisan views as well as their different ideas about the role of attorney general.

Herring has gone after the Trump administration’s policies, challenging the constitutionality of the president’s first immigration ban, joining with other attorneys general in suing the administration over its decision to end federal subsidies to health insurers while also opposing the administration’s move to end contraception coverage required by the Affordable Care Act.

Herring also joined a lawsuit that challenged Virginia’s ban on same-sex marriage, a case made moot by the decision by the U.S. Supreme Court that gay Americans have the right to marry.

His campaign plans to focus on health care in the final three weeks, highlighting Adams’s opposition to Obamacare and Medicaid expansion, as well as Adams’s support for the Trump administration’s decision to allow employers to deny workers insurance coverage for contraceptives.

Adams, a politically conservative attorney who works at a powerful Richmond law firm, charges that Herring should stick to the job of advising the General Assembly and defending state laws.

Adams said his personal beliefs — he is opposed to abortion, same-sex marriage and requirements that employers provide contraceptive coverage — will not influence his decisions as attorney general.

“I think the attorney general needs to defend the laws that the citizens passed . . . not pick and choose,” Adams told the Richmond Times-Dispatch editorial board recently.

The candidates accuse each other of misrepresenting their positions.

But Mark Rozell, dean of the George Mason University Schar School of Policy and Government, said both men are simply playing to their base, trying to turn out their voters in what is traditionally a low-turnout election.

Polls show that Herring holds a narrow but consistent lead over Adams, but many voters remain undecided.

“It seems that the candidates have all forgotten about appealing to the middle and mobilizing the independent voters, which is puzzling given that the Post/Schar School poll showed the Virginia electorate is about one-third independents,” Rozell said. “Appealing to the independent voter used to have a moderating influence on campaigns. Now that candidates play mostly to the base, all restraint goes out the window.”

The latest stories and details on the 2017 Virginia general election and race for governor.

The candidates will meet Friday morning at a Leesburg event sponsored by the Loudoun County Chamber of Commerce, and unlike their June 17 meeting, this one could be bare-knuckled.

With just three weeks to go before Election Day, each camp is running both broadcast and digital attack ads. Herring’s latest, released Monday, calls Adams’s health-care stance “a disaster for Virginia families . . . seniors charged thousands more . . . denying coverage to thousands of veterans, children and the disabled.”

The Adams campaign, meanwhile, “tweaked” an earlier ad that targeted Herring for failing to follow up a proposal by his predecessor, Republican Ken Cuccinelli II, who suggested setting aside money to build shelters for victims of sex trafficking. The new version removes disputed details but charges that Herring “put his friends ahead of the needy, the vulnerable, victims.”

The Republican Attorneys General Association has been the single biggest donor to the Adams campaign so far, giving $2.75 million.

The Adams campaign says three-quarters of its ad spending has been positive.

“Our strong fundraising allows us to advertise statewide to introduce John, a first time candidate for any office, to Virginia voters and highlight what makes him the best choice to be the next Attorney General,” campaign manager Nick Collette said in a statement. “We also have the resources to educate voters on Herring’s dismal record as Attorney General — a record of pursuing his political agenda and ignoring the law.”

The Democratic Attorneys General Association, Herring’s top donor, has given more than $1 million to Herring, and Michael Bloomberg’s Independence USA PAC has contributed $825,000 in the past two years.

Pro- and anti-gun groups are also weighing into the race, with the National Rifle Association spending more than $600,000 on anti-Herring ads this election season, Zuckerman said. Everytown for Gun Safety Action Fund, an advocacy group funded by Bloomberg, is supporting Herring with $300,000.

Both campaigns reported raising about $1.6 million in campaign contributions in September. The Herring campaign reported that it started October with more than $2.5 million cash on hand. Adams raised $1.6 million in September, and as of Sept. 30, his campaign fund had $251,000 cash on hand, but the campaign said it added $1.6 million during the first two weeks of October.