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.
He did so in a low-turnout primary on Tuesday when many centrist Republicans apparently stayed home, unhappy with a three-way race among candidates all professing strong loyalty to President Trump and given to fiery culture war pronouncements.
Mr. Stewart, the chairman of a county board of supervisors who briefly led Mr. Trump’s 2016 campaign in Virginia, received a congratulatory overnight tweet from the president, who called Mr. Stewart’s Democratic opponent, Senator Tim Kaine, “a total stiff.”
Tellingly, though, the National Republican Senatorial Committee, the party’s campaign arm, said it would not support Mr. Stewart, who lags far behind Mr. Kaine in fund-raising and has a history of cozying up to white supremacists and anti-Semites that threatens to make him an albatross for down-ballot Republicans.
White House officials said the president was unlikely to cross the Potomac River to campaign personally for Mr. Stewart unless there were signs that his race against Mr. Kaine had become competitive.
The real worry for national Republicans — and the hope for Democrats — is that Mr. Stewart’s nomination may cost some incumbent Republicans in Virginia their seats in Congress.
“For the G.O.P. candidates in the down-ballot House races in Virginia, having Stewart on the ticket is going to be a very tough challenge,” said Mark Rozell, dean of the Schar School of Policy and Government at George Mason University. “Somehow they will need to separate themselves from the more extreme elements of his message, while at the same time not alienating the Trump Republicans whose votes will be needed.”
Virginia Democrats quickly moved to join Mr. Stewart at the hip to other Republicans in competitive House races.
“There is no place to hide — you are either running with Corey Stewart and you condone his vile politics, or you don’t,” said Susan Swecker, the state Democratic chairwoman.
Mr. Stewart could especially hurt Representative Barbara Comstock, a Republican defending a seat in affluent Northern Virginia that is emblematic of how the state has been shifted from its once-fixed Republican moorings by an influx of immigrants and college-educated professionals. Hillary Clinton won in Ms. Comstock’s district, the 10th, by double digits in 2016.
Ms. Comstock, who has generally supported Mr. Trump, held off a primary challenge from her right on Tuesday.
“The good news is that Congresswoman Barbara Comstock won her challenge,” said David Ramadan, a Republican former state legislator in Virginia. “And the bad news is, my good friend who has lost his mind, Corey Stewart, has become the nominee for the Senate.”
Virginia has been moving steadily from being a solid Republican state to one that is reliably Democratic in statewide elections. The populous counties outside Washington and around Richmond are now filled with highly educated voters, immigrants with white-collar jobs in the technology industry, and suburban women, groups that tend to have more moderate views than the Trump-led national Republican Party.
The center of gravity for the Republican Party in the state has shifted “from the country club to the country,” as one Republican strategist, Tom Davis, put it.
“Every candidate will be asked if they support Stewart,” said Mr. Davis, a former congressman from Virginia. “This is more nuanced than the media would have you believe, but in high-education areas, it is a killer.”
The establishment wing that once dominated the party did not even field a candidate in the Senate primary on Tuesday. Instead, Mr. Stewart faced a little-known state lawmaker, Nick Freitas, and a Christian minister given to divisive outbursts, E.W. Jackson.
Turnout in the race was noticeably low. Mr. Stewart’s 136,500 votes on Tuesday were about 20,000 fewer than he received in the Republican primary for governor last year, a race he lost.
If the turnout pattern repeats in November, at least two other Republican House members besides Ms. Comstock could also be in trouble: Dave Brat and Scott Taylor.
“Stewart’s fearmongering and division-sowing campaign will turn many Virginians to the Democratic ticket,” said Schuyler VanValkenburg, a Democratic state legislator who lives in Mr. Brat’s district, the Seventh.
Abigail Spanberger, the Democratic nominee challenging Mr. Brat, is a former C.I.A. officer who won more votes on Tuesday than any other House candidate in the state.
Katey Price, Mr. Brat’s campaign manager, said on Wednesday, “I see this as a very winnable district and very winnable race, and we’re going to run a smart campaign focused on the issues.”
Mr. Taylor, a former Navy SEAL who represents the Second District, centered on Virginia Beach, will face Elaine Luria, a former Navy commander.
“My opponent will either embrace Corey Stewart, be silent or distance himself from him,” Ms. Luria said in an interview. “Virginia favors equality, diversity and economic opportunity for all. Corey Stewart’s race-baiting rhetoric is offensive to everybody in Virginia.”
Mr. Taylor angrily responded to a Twitter taunt from the state Democratic Party that asked him if he thought Mr. Stewart was a racist and whether the two men would campaign together.
“Let’s see you jokers bring your weak identity politics campaign, trying to make it about race in #VA02, see how it works out for you,” Mr. Taylor tweeted back. “Not gonna happen.”
Mr. Stewart, 49, has spent years courting voters on the rightward fringes of his party, often by playing to anti-immigration sentiment. He made the defense of Confederate monuments the focus of his unsuccessful 2017 primary campaign for governor. “Nothing is worse than a Yankee telling a Southerner that his monuments don’t matter,” he said on Twitter, though he was born in Minnesota.
In January 2017, Mr. Stewart met with and praised Paul Nehlen, an outspoken anti-Semite who is now making his second run for Congress in Wisconsin.
Mr. Stewart was also endorsed last year by the white nationalist Jason Kessler, who later helped organize the deadly white supremacist rally in Charlottesville.
Mr. Stewart has since distanced himself from both Mr. Nehlen and Mr. Kessler.
As chairman of the Prince William County Board of Supervisors, Mr. Stewart promoted a policy in 2007 to deny county services to immigrants without legal status. The rule, which was updated to require police officers to check the immigration status of anyone they arrested, drew intense opposition and brought Mr. Stewart to national attention.
Elizabeth Guzman, a Democratic state lawmaker representing the district where Mr. Stewart lives, said Mr. Stewart was able to win his county office largely because many Democrats did not vote in local elections. That trend was dramatically reversed in November, when Democratic candidates took 15 Republican-held seats in the statehouse.
“Now that we are engaging everybody in the process, he is not winning in November,” Ms. Guzman said of Mr. Stewart. “When you are going to vote on the Republican ticket, he is going to be the head of that line, and as soon as people see that name, it will turn off people.”
Mike Tackett reported from Manassas, Va., and Trip Gabriel from New York. Maggie Astor contributed reporting from New York, and Jonathan Martin and Nicholas Fandos from Washington.