Democratic primary results:

Republican primary results:

In a surprisingly close race, Republican Ed Gillespie barely secured the GOP nomination in the Virginia gubernatorial primary on Tuesday after fending off a stronger-than-anticipated challenge from Corey Stewart, a controversial conservative candidate who embraced President Trump and pitched himself as an immigration hardliner and defender of Confederate monuments.

The Associated Press called the race for Gillespie just before 10:30 p.m. ET. Decision Desk HQ projected that Gillespie would win shortly before 10 p.m. ET.

Gillespie, a former Republican National Committee chair, who worked to distance himself from Trump, held a lead in most pre-election polls, while Stewart was considered a long-shot candidate. Stewart, the chair of the Prince William Board of County Supervisors, once claimed that he “was Trump before Trump was Trump,” and has been described by The Washington Post as “Trump’s Virginia Mini-Me.” He formerly served as Virginia chair for the Trump campaign, but the campaign fired him after he participated in a protest at the Republican National Committee headquarters.

The fact that the Republican race turned out to be so competitive as the votes were counted is sure to set off shockwaves among Washington political observers. The Republican establishment may have prevailed Tuesday, but the close result could nevertheless convince future conservative candidates that embracing Trump’s brand of politics isn’t a lost cause in battleground states.

Gillespie will face off against Ralph Northam, the state’s current lieutenant governor, who secured the Democratic nomination, in November’s general election to succeed outgoing Democratic Governor Terry McAuliffe. Northam has denounced Trump on the campaign trail, and even called the president a “narcissistic maniac” in an ad.

Ahead of Tuesday’s result, the Democratic primary had been viewed as the marquee contest in Virginia and an early test of Democratic voter sentiment in a battleground state in the Trump era given how competitive the race looked while the GOP primary appeared to be a near-lock for Gillespie. Northam’s defeat of Tom Perriello, a former representative who described himself as a “pragmatic populist” and won endorsements from progressive icons Bernie Sanders and Elizabeth Warren, is sure to disappoint the party’s liberal wing.

Both Democrats ran on a progressive policy agenda and meted out anti-Trump attacks, but there were meaningful differences between the candidates. While he took pains to emphasize a progressive voting record and platform, Northam’s campaign nevertheless lacked the pointed critique of corporate power that featured prominently in Perriello’s campaign as it channeled the economic populism that Sanders elevated to the forefront of American politics during the 2016 presidential primary.

It would be overly simplistic to say that Perriello’s defeat was a clear-cut loss for Sanders-style progressivism. The former congressman ran on a platform that did not entirely align with that of the Vermont senator’s presidential primary agenda, and labeled himself a “pragmatic populist.” But the outcome may nevertheless be taken as a rebuke of Sanders-style populism, even if the result of any individual race has only limited power to signal broader trends in the electorate.

It’s not yet clear exactly what the impact of the Republican primary result will be at the national level. On the campaign trail, Stewart framed his primary bid as a test of Trump’s appeal. Stewart gained notoriety during his primary race for a series of controversial statements he made in defense of Confederate memorials. In April, the Minnesota native faced backlash after tweeting: “Nothing is worse than a Yankee telling a Southerner that his monuments don’t matter,” in the midst of a nationwide debate over the removal of Confederate icons.  

For his part, Gillespie attempted to sidestep national politics as much as possible by training his focus instead on statewide issues. “Virginians are focused on Virginia,” Gillespie told NBC in an interview. There were clear signs that Gillespie was attuned to the national political mood, however. During his campaign, he attempted to reach out to conservative voters concerned about illegal immigration with promises to step up enforcement.

Trump himself lost Virginia in the presidential election, so Stewart’s forceful primary challenge may lead Trump supporters to argue that the president’s appeal is nevertheless broad in the battleground state. For now, however, the Republican establishment is likely breathing a sigh of relief after Tuesday’s nail-biter of a GOP primary.

Democrats will start the march toward the general election in a relatively strong position. Recent polls of possible general election matchups found both Democratic candidates, Northam and Perriello, leading Gillespie by comfortable margins ahead of Tuesday’s results. That may change leading up to the general election in November, but as of now, Democrats appear poised to have an edge heading into the fall.