Voters fill out their ballots in Short Pump, Va., on Nov. 6. (Steve Helber/AP)

Virginia voters go to the polls Tuesday for primaries in a crucial election year when control of the legislature is at stake.

The nominating contests show the state’s two major parties wrestling with identity in ways that mirror national tensions. Several Democratic incumbents are being challenged from the left by progressives, while three Republican incumbents who voted with Democrats to expand Medicaid are facing challenges from the right.

Other candidates are jockeying to run for open seats that could help determine majorities in the House of Delegates and state Senate.

All 140 seats in the legislature will be on the ballot in November. Republicans are trying to hold on to two-seat majorities in both chambers.

Most races already have their candidates set, but Tuesday’s primaries will determine candidates for one or both parties in 18 House districts and 14 Senate districts.

Polls open at 6 a.m. and close at 7 p.m. Virginia primaries are open to any registered voter; membership in a particular party is not required.

The House contests are following a new district map imposed this year by federal judges who had found the old map to be racially gerrymandered. The court’s map redrew lines for 26 House districts in the Hampton Roads and Richmond areas, tilting six Republican districts more heavily Democratic, according to an analysis by the nonpartisan Virginia Public Access Project.

Republicans have appealed to the U.S. Supreme Court, which has heard arguments but not ruled in the case. If the court were to throw out the new map, Tuesday’s primary process could be wholly or partially discarded, casting the election into chaos.

Quentin Kidd, the director of the Wason Center for Public Policy at Christopher Newport University, said he will be paying close attention to two primaries that pit veteran senators against younger upstarts to their right and left.

In one, Sen. Emmett W. Hanger Jr. (R-Augusta) faces a challenge from Tina Freitas over his support for expanding Medicaid under the Affordable Care Act.

In the other, Sen. Minority Leader Richard L. Saslaw (D-Fairfax), a socially liberal but pro-business Democrat, faces progressive challenger Yasmine Taeb. Taeb has the endorsement of the Democratic Socialists of America and advocates for free Metro service, decriminalization of prostitution and abolishing the U.S. Immigration and Customs Enforcement agency.

“Those would really be telling about where the two parties are moving,” Kidd said.

Kidd said Freitas’s challenge to Hanger fits a dynamic that has been at work for many years — a Republican establishment figure targeted by a challenger to his right. The trend started with the tea party movement and continues with “liberty Republicans,” as Freitas brands herself.

Kidd said the Saslaw-Taeb race shows that a similar anti-establishment fervor has spread to the Democratic Party.

“If somebody like Dick Saslaw can get knocked off, it just means that energy on the left is serious and real,” he said. “The Democrats would be doing what Republicans did a decade ago.”

Kidd is also watching turnout in a couple of races for open Senate seats where both parties think they have a shot.

One is the Northern Virginia seat being vacated by retiring Sen. Richard H. Black (R-Loudoun), one of the Senate’s most outspoken conservatives. The other seat is already vacant: Sen. Frank W. Wagner (R-Virginia Beach) stepped down after Gov. Ralph Northam (D) appointed him deputy director of the state lottery in May.

In Wagner’s district, two Republicans and three Democrats are fighting for their parties’ nominations. In Black’s district, Del. John J. Bell faces no opposition in the Senate primary. But two Republicans — Geary Higgins and Ron Meyer — are battling in a big way.

“The two open races give us some indication about where energy is on both sides,” Kidd said.

Other significant primary races include:

• Sen. Rosalyn R. Dance (D-Petersburg) faces a strong challenge from former delegate Joe Morrissey in a heavily African American district that stretches from Henrico County along the eastern edge of Richmond through Hopewell and into Petersburg. Dance is a black former Petersburg mayor who has embraced scandal-tinged Northam, while Morrissey is white and spent time in jail for having sex with his then-17-year-old receptionist.

Now married to the former receptionist and fighting to get his law license back, Morrissey is a celebrity and hero to some in the district for his efforts as a defense lawyer who defies the system. While the Democratic establishment is backing Dance, Morrissey has run before as an independent and regularly thumbs his nose at the party. A victory for him could complicate efforts to achieve a united Democratic majority in the Senate. No Republican has filed to run in the district.

• In addition to Hanger, two other Republicans drew challengers because of their support for Medicaid expansion — which was backed last year by a total of 23 House and Senate Republicans. Del. Robert M. Thomas Jr. (Stafford), a freshman delegate representing the 28th District in Stafford County and Fredericksburg, faces former Stafford supervisor Paul Milde on Tuesday. Milde has made opposition to Medicaid expansion central to his argument for the nomination.

•Del. Christopher K. Peace (Hanover), a 13-year veteran in the 97th District northeast of Richmond, has been challenged by Hanover County Supervisor Scott Wyatt, who claims Peace abandoned his conservative constituents with the Medicaid vote. But that contest will not be decided Tuesday.

Both candidates claim to have already won the nomination — Wyatt at a May 4 convention, Peace at a June 1 firehouse primary. A dispute over which nomination contest was legitimate is unresolved. The situation is likely to go before party committees and perhaps wind up in court.

• In Northern Virginia, several veteran Democrats are fighting challenges from the left. They include: Sen. Barbara A. Favola (Arlington), who faces Nicole Merlene; Del. Kaye Kory (Fairfax), who faces Andres Jimenez; and Del. Alfonso H. Lopez (D-Arlington), who faces J.D. Spain.

Favola and Kory have been criticized by rivals for taking donations from Dominion Energy, while Lopez was targeted for consulting work he once did for a private company that operates detention facilities for U.S. Immigration and Customs Enforcement.

At the same time, self-declared socialist Del. Lee J. Carter (D-Manassas) has a nomination challenger from the right: Manassas City Council member Mark Wolfe.

• Four Democrats are vying to run for the 87th District House seat in Loudoun and part of Prince William that is being vacated by Bell, who is running for state Senate. The district has been reliably Democratic for years.

All four candidates seeking the Democratic nomination against Republican candidate Bill Drennan are first-generation Americans: Hassan Ahmad, Akshay Bha­midipati, Johanna Gusman and Suhas Subramanyam, who leads in fundraising. Ahmad is next in cash raised, with the other two candidates trailing by a wide margin.

• Several Republican House members whose districts were altered by the court-ordered map announced their retirement this year, though none cited the change as the reason. In Hampton and Poquoson, Del. Gordon C. Helsel Jr. retired after the new map shifted his 91st District to the left by nearly 20 points, according to VPAP’s analysis. Two Democrats — Martha Mugler and Michael Wade — are vying to run against Republican Colleen Holcomb.

In Hopewell, Del. Riley E. Ingram (R) stepped down after his 62nd District shifted to nearly an even split, according to the VPAP analysis. Democrats Lindsey Dougherty and Tavorise Marks are vying to take on Republican Carrie Coyner for that seat.

Correction: An earlier version of this story incorrectly reported that Taeb favored legalization of prostitution. She supports decriminalization. This story has been updated.