Republicans on Wednesday faced a stark new political reality in Virginia after losing majorities in both chambers of the General Assembly, a sweeping defeat that solidifies Democratic control there for the first time in a generation.

Depleted by President Trump’s foundering approval rating in Virginia, the Republicans’ defeat was a new nadir for a party that has not won a statewide race since Robert F. McDonnell’s 2009 gubernatorial victory.

“If you didn’t see this coming, you’ve been living under a rock,” said Dan Scandling, who was chief of staff to former congressman Frank Wolf (R-Va.). “Virginia has been trending this way for years. Being so close to Washington — and add in the anti-Trump phenomenon — it was only a matter of time.”

With Democrats already controlling the governor’s mansion, both U.S. Senate seats and a majority of the congressional seats, Republicans are bracing for policy changes in Richmond and the specter of Democrats redrawing legislative districts after the 2020 Census that could undermine GOP incumbents from the statehouse to Congress.

“The Republican Party is toast in Virginia for the next 10 years,” said Corey A. Stewart, the outgoing chairman of the Prince William Board of County Supervisors who was the Virginia GOP’s nominee for the U.S. Senate in 2018. “Republicans will cease to be a serious political power.”

But other Republicans rejected that apocalyptic vision. They saw the current pendulum swing favoring the Democrats as an inevitable reaction to a Republican occupying the White House.

“There’s no such thing in democracy as a permanent thing,” said Jeff Ryer, a spokesman for Virginia’s Republican Senate caucus. “There’s no question that there’s a blue tilt, but this idea that Republicans wake up this morning and say, ‘Virginia is gone, let’s move’ — no, it’s not that way. You figure out what to do next.”

A total of 1.2 million Virginians cast votes for Democratic state Senate candidates on Tuesday, while 892,000 chose Republicans, according to the state board of elections. More than 1.1 million voters supported Democratic House of Delegates candidates, while 985,000 chose Republicans.

Democrats flipped two seats in the state Senate and five seats in the House, ensuring majorities in both chambers. They also gained several seats and took control of the boards of supervisors in both Loudoun and Prince William counties, electing a Democrat to helm the board that Stewart led for 13 years.

The ranks of vanquished Republicans included Del. Tim Hugo, the GOP’s last member of the Northern Virginia delegation, who lost to Democrat Dan Helmer.

At the polls, many voters expressed a desire to send a message to the White House.

“I’m not too thrilled with the direction the Republican Party is taking our country,” said David Goodwin, 41, a tech salesman who leans Democratic but often crosses party lines, after voting a straight Democratic ticket in Leesburg.

“What the last national election taught me was party doesn’t necessarily mean a whole lot,” he said. “You’ve got to look at the person.”

Brandy Lloyd, 50, a tech worker, said that she, too, voted a Democratic ticket although she usually supports Republicans. “But seeing what’s happening in Washington, I think it’s time for a change,” she said.

With Trump’s approval rating in Virginia falling below 30 percent over the summer, Republicans were well aware that the president could be an albatross for GOP candidates. Two years ago, just after Trump was elected, a voter revolt propelled Democratic Gov. Ralph Northam over Republican Ed Gillespie even in conservative-leaning suburban districts.

This fall, the president made no campaign appearances in Virginia. Instead, Vice President Pence traveled to Virginia Beach, an appearance that Democrats themselves publicized to stir up anti-Trump fervor.

But singling out Trump as the reason for Republican failures in 2019 “is too easy,” said Mark Rozell, a George Mason University professor of public policy. Rather, he said, Virginia’s GOP over the past decade has gravitated toward the right on social issues and alienated moderate voters.

Gillespie, for example, embraced a hard-line anti-immigrant stance during his 2017 gubernatorial race after preaching the importance of the Republican Party adopting a more tolerant message to attract voters.

“Democrats have had an easy time characterizing the Republicans as out of the mainstream on issues,” Rozell said. “Republicans in Virginia need to rebrand, refocus and broaden their appeal.”

For decades, Virginia was reliably conservative, choosing Republican candidates in every presidential primary from 1968 to 2004. But demographic changes in large portions of the state, including a population explosion in Northern Virginia from the early 1990s through 2010, turned the commonwealth from red to purple.

And now?

“At this point, Virginia has become a blue state — how can you call it anything else?” Rozell said. “In a state that was long considered leaning red and two-party competitive at best, who could have predicted that the Republican Party would fall so dramatically and quickly?”

Shaun Kenney, the former head of the Republican Party of Virginia, said the party was harmed in recent years by candidates such as Stewart, who defended the Confederate flag during his unsuccessful 2017 bid for governor.

Kenney described the Republicans as evolving from “the party of Reagan to the party of Trump — one side believes in free markets, free minds and free society, and the other side wants to build a wall that doesn’t exist and wants Mexico to pay for it.”

But Kenney rejected the notion that Virginia is now a Democratic stronghold, citing the nearly 2 million votes for Republican candidates on Tuesday.

“It’s a red state that can’t get its act together,” he said. “Instead of making the case for good government, we’re hopping on the crazy train.” No one is going to vote for a Republican Party that is waving around Confederate flags.”

Even before results were announced Tuesday night, leaders of gun-control groups were taking a victory lap at the Democrats’ rally in Richmond. John Feinblatt, president of Everytown for Gun Safety, said a turning point in the campaign was GOP legislators’ move to shut down a special legislative session in July on gun control, after the May 31 mass shooting in Virginia Beach.

“I think what we’re going to learn tonight is that was a huge political mistake,” he said. “Republicans really turned their backs on citizens of the commonwealth by not taking up a single gun safety measure.”

How Democrats handle their newfound power could determine whether the party remains dominant in Virginia. If Democratic legislators push a progressive agenda, for example, the party risks alienating centrist voters.

“There’s the seed to their demise,” Stewart said. “They’re not going to be able to control the pressure to go as far left as possible. While Virginia may seem like it’s moving to the left, it’s still right down the center.”

But Ben Tribbett, a Democratic operative, said the party’s moderate leaders — including Northam and state Sen. Richard L. Saslaw (D-Fairfax), who is to become Senate majority leader — retain enormous influence.

“They’re both centrists,” he said. “You’re not going to see a coup from the far left. There aren’t enough votes for that.”

Staff writer Laura Vozzella contributed to this report.