Sen. Tim Kaine (D-Va.) left, and Republican challenger Corey A. Stewart after a debate in Richmond. (Steve Helber/Associated Press)

For months, Sen. Tim Kaine (D-Va.) barely acknowledged opponent Corey A. Stewart as the provocative Republican repeatedly called him “weak” and “ineffective” while falsely accusing the moderate of being part of the far-left antifa movement.

But after Stewart’s darker implication — also without evidence — that Kaine has been accused of sexual harassment, the usually upbeat former Virginia governor is punching back.

A Kaine campaign television ad that began airing Monday calls Stewart, chairman of the Prince William Board of County Supervisors, “dangerous,” while highlighting the fact that Stewart skipped a vote in December for emergency funding for opioid prevention in the county to travel to Alabama to help Republican Roy Moore in his failed Senate bid.

“That’s who Corey Stewart helped instead of voting on opioid prevention,” Maggie Hansford — a Democrat who plans to run for Prince William county supervisor in Brentsville next year — said in the commercial, calling Moore an “accused child predator” in reference to allegations of sexual misconduct involving teenage girls during the 1970s.

Titled “Eliminate,” the commercial — airing in the Richmond area, Roanoke and Norfolk — is Kaine’s first negative ad in a race where most polls show him up by nearly 20 points with less than four weeks to go before the Nov. 6 election.

Through the ad, the Kaine campaign is seeking to further erode Stewart’s support among moderate Republicans in hopes of getting those voters to either sit out the election or vote for Kaine and the Democrats running in Virginia’s hotly contested House races.

The ad underscores Kaine’s efforts to deal with the opioid crisis through a recently passed bipartisan bill he sponsored that, among other things, would boost federal funding for prevention, said campaign spokesman Ian Sams. The bill, which recently passed the Senate by a vote of 99 to 1, is awaiting the president’s signature.

“If [Stewart] would prioritize supporting someone like Roy Moore over tackling the opioid epidemic in his own county, voters can imagine how dangerous he would be for Virginia as a U.S. Senator,” Sams said in a statement.

But the ad does not give a complete picture of the facts behind the county’s funding measure for opioid prevention.

The measure failed 5 to 2 after the board’s Republican majority chose to wait to learn what the state would allocate for the opioid crisis — an outcome Stewart said he anticipated and, therefore, thought he could skip to campaign for Moore, who he argues was falsely accused.

Stewart was present for another vote in April, when the board unanimously adopted a new spending plan that includes $430,000 to hire three therapists for addiction treatment.

“I’m pretty proud of the county’s response to the opioid crisis,” he said. “Nobody has been able to figure this out yet.”

To Stewart, the ad shows that the Kaine campaign is worried about Stewart gaining on the senator amid a Republican backlash over the sexual assault allegations against Brett M. Kavanaugh that rocked his Supreme Court nomination.

“You don’t attack your opponent unless you feel threatened by him,” Stewart said. “If he felt he was way ahead, the last thing you want to do is to bring attention to the race and bring attention to your opponent.”

Sams said the Kaine campaign isn’t worried about a Kavanaugh-related backlash and doesn’t think the senator is losing ground to Stewart.

During their two debates in recent weeks, Stewart called on Kaine to “release the names” of members of Congress who have settled sexual harassment claims, complaining that $17.2 million in tax dollars were used to defend lawmakers whose identities have been protected by confidentiality rules.

The demand misrepresents payments made since 1990 to federal employees for violations of a variety of employment rules, including the Americans With Disabilities Act and regulations governing labor and sexual harassment.

A “large portion” of those cases involved cafeteria workers, groundskeepers and Capitol Hill employees other than lawmakers and their staffs, according to the congressional Office of Compliance.

Bob Holsworth, a former Virginia Commonwealth University political science professor, said Stewart appeared to be getting under Kaine’s skin during their most recent debate, where the senator gripped the lectern while Stewart repeatedly implied that Kaine is among the accused harassers.

But Kaine may be more concerned that Democratic voters are so confident he’ll win that they won’t bother to vote, which could hurt down-ballot candidates, Holsworth said.

Voter complacency nearly cost Sen. Mark R. Warner (D-Va.) the election in 2014, when he beat Ed Gillespie by less than one percentage point, he noted.

Kaine’s ad, which points out that Moore said the country was last “great” during slavery, may help motivate Democrats and moderate Republicans by reminding them of Stewart’s own controversies over ties to white nationalists, Holsworth said.

“Tim Kaine, by acting differently here, shows he is taking this very seriously,” Holsworth said. “He’s running a campaign as if he were 16 points behind instead of 16 points ahead.”