RICHMOND, Va. (AP) — Polls have opened in Virginia as the state picks a new governor in a race that's being closely watched nationwide.

Republican Ed Gillespie and Democrat Ralph Northam have been locked in a heated race to succeed Democratic Gov. Terry McAuliffe, who cannot seek a second term. The contest is viewed by many as a referendum on President Donald Trump and a possible preview of the 2018 midterm elections. Libertarian Cliff Hyra is also running.

Virginians will also elect a new state attorney general race and lieutenant governor. Democratic Attorney General Mark Herring is seeking a second term. He's being challenged by Republican John Adams.

Democrat Justin Fairfax and Republican Jill Vogel are competing to be the next lieutenant governor.

All 100 state House seats are also up for grabs.