MANASSAS, Va. — He once stood proudly before a Confederate flag, declaring it was not a symbol of hatred, but “about our heritage.”

After the march of torch-carrying white supremacists in Charlottesville last year, which led to the death of a counterprotester, he criticized “weak Republicans” who “couldn’t apologize fast enough.”

As officials around Virginia have grappled with whether to remove Confederate statues, he has compared those politicians to leaders of the Islamic State.

Now Corey Stewart, a county official who for years has played to the hard-right fringe, captured the Republican nomination for Senate in Virginia.