Voting has begun in primary elections Tuesday in Virginia, where off-year contests for all 140 seats in the state legislature can serve as a political barometer for the coming presidential election year.

The state's elections in 2017 were an early warning signal that a blue wave of opposition to President Donald Trump would wash over the 2018 U.S. midterms, and political analysts are looking for clues about trends in 2020.

Normally sleepy affairs, this year's primary contests feature plenty of drama as moderates in both parties take fire from their outer flanks. All 140 legislative seats are up for grabs, and Virginia is the only state whose legislature has a reasonable chance of flipping partisan control. Republicans currently have narrow majorities in both the House and Senate.

Get Breaking News Delivered to Your Inbox

On the GOP side, lingering resentment over last year's vote to expand Medicaid in Virginia is fueling unusually divisive primary contests. Among Democrats, an unusually high number of incumbents are being challenged by liberal newcomers who aren't shy about attacking their opponents as ethically compromised and out of step with the party's base.

Democrats are hoping they can continue a three-year winning streak, powered in large part by suburban voters unhappy with Trump who are fleeing the GOP.

But the party lost a major advantage earlier this year when its top three statewide office holders became ensnared in scandal. A racist yearbook photo surfaced in February and almost forced Gov. Ralph Northam from office. Lt. Gov. Justin Fairfax was then accused by two women of sexual assault, which he denies. And Attorney General Mark Herring, after calling for Northam to resign, revealed that he too wore blackface once in college.

The incumbents in peril include two of the state's most powerful senators. Democratic Senate Minority Leader Dick Saslaw and Republican Sen. Emmett Hanger, with more than seven decades of combined experience as lawmakers, both face spirited opponents.

Saslaw, a canny veteran of Capitol politics who is ardently pro-business and chummy with Republicans, hasn't faced a primary challenger in 40 years. This year he has two. And one of them, 39-year-old human rights lawyer Yasmine Taeb, has painted Saslaw as too conservative and too cozy with special interests.

Hanger played a key role in the health care expansion that made 400,000 low-income Virginia adults eligible to enroll in Medicaid last year, even defeating his own party's plan to derail the effort during one committee hearing. His opponent, Tina Freitas, said Hanger has betrayed his constituents by supporting Medicaid, and isn't conservative enough on guns or abortion. The state's hospitals have spent heavily to help Hanger hold on to the GOP nomination.

Similar themes are playing out around the state. Republican Del. Bob Thomas also voted for Medicaid expansion and is trying to hold on to this Fredericksburg-area seat.

And Del. Lee Carter, a self-proclaimed democratic socialist who was one of the biggest surprise winners in 2017, is trying to fend off a more moderate primary opponent.

Tuesday's vote also features a comeback attempt by one of Virginia's most colorful politicians. Joe Morrissey, a former state lawmaker who used to spend his days at the state Capitol and his nights in jail after being accused of having sex with his teenage secretary, is looking to unseat incumbent Sen. Roslyn Dance in a Richmond-area Democratic primary.

There's also plenty of local action. In Fairfax County, multiple candidates are running for the Democratic nomination to lead the Board of Supervisors. And two prosecutors' races in northern Virginia have been flooded with cash from a political action committee financed by liberal billionaire George Soros on behalf of two challengers who want to make the criminal justice system fairer to the accused.