RICHMOND, Va. — Just as Virginia's 2017 elections were an early warning signal that an anti-Trump blue wave was headed for the 2018 U.S. midterms, this year's state legislative elections could offer strong clues about national trends in 2020.

So far, ugly infighting seems to be the norm in the Virginia House of Delegates and state Senate, where all 140 members are up for re-election, and in Northern Virginia county and independent city primaries.

The primaries are Tuesday, and both Republicans and Democrats are in the midst of battles over their parties' identities and values.

Check latest elections results here

One wildcard: Virginia voters, no matter which party they identify with, can choose either party's ballot during a primary election. It is one of 22 states with open primaries.

►  VA. ELECTION RESULTS: Find out the winners here in your local races
►  JUNE 4: Va. gov says he'll have special legislative session on gun control

Newcomers in the mold of U.S. Rep. Alexandria Ocasio-Cortez, who has emerged as a leading liberal voice after an upset win in a Democratic primary in New York last year, are challenging an unusually high number of Democratic incumbents.

That includes Senate Minority Leader Dick Saslaw, a veteran of Richmond politics who is ardently pro-business and chummy with Republicans.

The 79-year-old Springfield Democrat who represents the cities of Falls Church as well as portions Alexandria and Fairfax County, hasn't faced a primary challenger in 40 years. This year he has two opponents.

On the GOP side, lingering resentment over last year's vote to expand Medicaid is helping fuel unusually divisive primary contests. One nomination battle has both candidates claiming victory in a fight that's become a proxy battle between the state's top two Republicans.

"The anger and the hatred and the venom that has been cast our way has certainly been surprising," said GOP Del. Chris Peace, a low-key House incumbent representing a Richmond-area district and one of those voting for expansion.

►  MAY 31: Candidates battle for top Fairfax County leader position
►  MAY 22: Woman questioned Muslim delegate about Sharia law in Va.

Virginia is the only state whose legislature has a reasonable chance of flipping partisan control. Republicans now have narrow majorities in both the House and Senate.

Democrats are hoping they can continue a three-year winning streak, which has been powered in large part by suburban voters unhappy with President Donald Trump. A new court-ordered state House map, also is helpful for Democrats although the U.S. Supreme Court could overturn it.

But the party lost a major advantage earlier this year when its top three statewide office holders became ensnared in scandal, limiting their ability to raise money and lend other assistance.

• A racist yearbook photo surfaced in February and almost forced Gov. Ralph Northam from office. He is in his final term, and gubernatorial elections won't happen until 2021.

• Two women then accused Lt. Gov. Justin Fairfax of sexual assault, which he denies.

• And Attorney General Mark Herring revealed that he had worn blackface during his college days after calling for Northam to resign for similar behavior.

Democrats have been divided on how to respond.

In Northern Virginia, human rights lawyer Yasmine Taeb has been aggressive in painting Saslaw as too conservative and too cozy with special interests.

"This is our best opportunity to pick up Democratic majorities, and I want to make sure that we're electing the right Democrats," the 39-year-old said.

►  APRIL 13: Fairfax County considers legal defense fund for immigrants
►  MARCH 1: Apparently, in Virginia, it's 'Chairman,' not 'Chairwoman'

Saslaw has a massive cash advantage and has been pitching himself to voters as someone with a long record of accomplishments on kitchen table items — such as boosting spending on traffic improvement — and a solid record on liberal issues including gun control and raising the minimum wage.

Saslaw said the Taeb campaign has been telling voters that "we need to get all of these old white men out of office," and is part of an anti-incumbent crowd that wants radical change that he said most voters in his district oppose.

"It is what it is. You deal with it," he said.

On the GOP side, the state's two most powerful Republicans — Senate Majority Leader Tommy Norment in the Hampton Roads area and House Speaker Kirk Cox in suburban Richmond — are waging a proxy battle over an unusually divisive nomination contest for a safe Republican House seat.

Peace is facing challenger Scott Wyatt, who claimed victory after a convention picked him earlier this month to be the Republican nominee. Peace and others have said the convention was rigged in Wyatt's favor and wasn't a legitimate way of deciding the contest.

►  FEB. 8: Virginia Democrat scandals could benefit Trump in 2020
►  FEB. 6: What's next for Virginia Democrats?

Norment publicly rebuked the Republican Party of Virginia's chairman, Jack Wilson, for siding with Peace. Cox publicly came to Wilson's defense in an indirect jab at Norment.

The district includes hardline conservative voters who helped former U.S. Rep. Dave Brat defeat U.S. House Majority Leader Eric Cantor five years ago in a historic political upset.

"The folks out here voted for Donald Trump," Wyatt said. "They're hard conservatives."

Across Northern Virginia, the parties are looking for nominees for local offices from soil and water conservation director to commonwealth's attorney to county board of supervisors.

Four candidates are running to become chairman of the Fairfax County Board of Supervisors. Sharon Bulova, a Democrat who has been in the position since 2009, is not running for re-election.

Sign up for the Get Up DC newsletter: Your forecast. Your commute. Your news.