Republican gubernatorial nominee Ed Gillespie. (Steve Helber/Associated Press)

The rioting in Charlottesville over the weekend has made one thing very clear: Virginia’s Republican party needs an exorcism.

And the only person who can do that is Ed Gillespie, the party’s gubernatorial nominee.

As with most of Virginia’s political class, Gillespie has strongly condemned the hatred and violence that erupted in Charlottesville.  But there was a notable dissent: Republican Corey A. Stewart.

As The Post’s Laura Vozzella and Fenit Nerappil reported, Stewart, “blamed ‘half the violence’ on counterprotesters and criticized fellow Republicans who condemned the white nationalists.”

The story continued: “ ‘All the weak Republicans, they couldn’t apologize fast enough,’ Stewart said in an interview with The Washington Post. ‘They played right into the hands of the left wing. Those [Nazi] people have nothing to do with the Republican Party. There was no reason to apologize.’ ”

Stewart will have his defenders: He’s right that these white supremacists have nothing to do with the GOP, are by no means conservatives, so what’s the big deal?

And they might even have a point if Republican politicians like Stewart hadn’t played footsie with these individuals for their own political ends.

While Stewart may disavow their aims, even as he engages in an equally cynical game of “whataboutism” regarding the others involved in the weekend violence, he used them as props in his bid for the GOP gubernatorial nomination.

That was cynical opportunism writ large. And, given Gillespie’s bizarre decision to ignore Stewart in the waning days of the nomination fight, Stewart’s tactics almost won.

Republicans may have avoided disaster in that contest. But Stewart declared his candidacy against Sen. Tim Kaine (D). That means the man and his baggage will be weighing Republicans down for months to come — unless Gillespie does something to weed anyone who would consort with white nationalists out of the Virginia GOP.

This will take no small amount of political courage, particularly as the conventional wisdom dictates that Gillespie needs Stewart supporters to win the November election.

Such a move would expose Gillespie to a river of alt-right bile.

As painful and undoubtedly disgusting as that would be, it would also serve to set Gillespie apart — far apart — from a thoroughly compromised Trump administration.

A Gillespie version of a “Buckley moment,” emulating William F. Buckley’s casting the toxic John Birch Society out of the conservative movement in the early 1960s, wouldn’t just cleanse the Virginia Republican ranks of a creeping cancer, it also would elevate him in the eyes of all sensible Virginians.

So far, he doesn’t appear ready to make the effort.

In an interview with Charlottesville’s WVIR television, Gillespie rightly called out the hatred and vileness of the neo-Nazis. He said such hatred is not what he sees on his campaign stops in Virginia and agrees with Gov. Terry McAuliffe (D) that these hate-mongers need to take their shields and go home.

That’s fine as far as it goes.

But the hate wasn’t entirely imported, and the vile views are hardly alien to the Virginia landscape.

It has roots here. Some, such as Prof. Larry Sabato, say that Virginia has exported a strain to the West Wing in the guise of presidential adviser Steve Bannon (a product of Richmond).

Sabato said the president should “fire all the white nationalists on his staff, starting with Steve Bannon.”

Gillespie should follow the good professor’s lead and write Stewart and his cynicism out of the Virginia GOP, and he should do it as soon as possible.

As my colleague Quin Hillyer wrote: “White supremacists are evil. They have no place in civil society. Period.”

The same goes for would-be senators who consort with these groups to advance their own political ends.