A tea party sign stands near a road in Spotsylvania in Virginia's 7th Congressional District, where Dave Brat upset House Majority Leader Eric Cantor in Tuesday’s Republican primary. (Jim Lo Scalzo/ European Pressphoto Agency )

It began with a sudden Democratic resignation that handed the Virginia Senate to the Republicans. In the middle, voters toppled the commonwealth’s most powerful emissary to Washington, House Majority Leader Eric Cantor. And it ended with GOP legislators yelling at one another over tactics but ultimately coming together to thwart the governor’s signature plan.

Just another week in Virginia politics.

Minted in recent election cycles as one of the swingiest states in the country, Virginia is coveted political real estate in Senate and presidential races. And as demographic shifts in the Washington suburbs continue to change a once-reliably conservative electorate, both parties are under increasing pressure to attract moderate and independent voters.

But this week, the right is smiling.

“It’s always a shift of power back and forth,” commented Sen. Richard H. Black (R-Loudoun), who successfully pressed colleagues to sharpen their already steadfast opposition to Medicaid expansion in a raucous late-night vote Thursday. But in just days, “there has been a tremendous advance for conservatives in Virginia. It was certainly not something people anticipated.”

How David Brat overwhelmed Cantor

Black, himself, is a divisive figure. In April, he sent a letter of praise to Syrian leader Bashar al-Assad for defending Christians and battling al-Qaeda, and as a delegate a decade ago, he sent pink plastic fetuses to 40 state senators to stir opposition to abortion. He said his party’s rifts between the center and right — on full display last week — aren’t weaknesses, just expressions of principle.

Tea party favorite Dave Brat defeated Cantor in Tuesday’s Republican primary, Black said, because Cantor and House Speaker John A. Boehner (R-Ohio) have been “somewhat contemptuous of the grass roots” and have been speaking out of “both sides of their mouths” on issues including immigration.

“I can respect somebody who said, ‘You know what, I think we ought to have open borders, and we ought to flood America with uneducated people who come here illegally,’ ” Black said. “Let’s have an honest debate on it.”

Family tensions within the GOP are hardly limited to the commonwealth.

“What’s happened to the Republican Party in Virginia is very much a microcosm of what’s happened to the Republican Party in national elections,” said John Ullyot, who was an aide to former U.S. senator John W. Warner (R-Va.). “The base demands one thing, and when you turn around and vote in general elections, you have a very different electorate that is not very receptive.”

For some Virginia Republicans, the 36,000 primary voters who roared into prominence with their votes for Brat sent the wrong signal.

“If all we’re interested in doing is winning legislative district or congressional district races, we’re in fine shape. . . . Those districts are very monolithic, thanks to the redistricting process,” said former lieutenant governor Bill Bolling. “But I’m not interested in that. I want to win top-of-the-ticket statewide political campaigns. To do that, we’ve got to be able to reach out to a broader cross section of voters. To do that, we’ve got to get the various factions of the party working together.”

Democrats hold all five statewide offices — governor, lieutenant governor, attorney general and the two U.S. Senate seats.

But Brat’s backers say replacing Cantor with their own populist, telegenic and articulate outsider will help provide an antidote to Beltway-style corruption and undue corporate influence — and be the jolt of energy their party needs to draw broader support.

“If we can unseat Eric Cantor, we can unseat anybody. It’s a clear warning to those who don’t think they are responsible to their constituents,” said Larry Nordvig, the Richmond Tea Party’s executive director and a Brat strategist. “When you get to Washington, it’s very easy to become corrupted. . . . It’s very hard for politicians to let go of that and come back to the vision of the Founding Fathers.”

Virginia’s GOP has a 68-to-32 majority in the House of Delegates. And last week, Republicans took back the Senate after Sen. Phillip P. Puckett (D-Russell) resigned with a plan to take a job at the state tobacco commission and, he said, to cope with family issues and clear the way for his daughter to secure a permanent judgeship. After an uproar, he said wouldn’t take the tobacco job.

In an interview in the hours after Puckett resigned, Cantor strategist Ray Allen Jr. dismissed Democrats who called the circumstances of the takeover unseemly, or worse.

“Welcome to the NFL, buddy,” Allen said.

Allen’s boss — Cantor — faced it next.

“I really view that as the tea party eating their own. Eric really has had a track record of catering to the tea party and going as far right as you comfortably can and still provide governance,” said state Sen. Emmett W. Hanger Jr. (R-Augusta). “People who are calling themselves conservative Republicans are really libertarians. They don’t like government period, or anyone associated with the government.”

Hanger had helped lead the push to expand Medicaid in Virginia, pitting him against the vast majority of GOP legislators. Black cheered activists and Medicaid opponents Thursday by pushing colleagues to stipulate that the General Assembly — and not the governor or a Medicaid commission — has the power to broaden the program. Some colleagues thought the tactic was unnecessary.

But in the electrified environment created by Cantor’s loss, Republicans were wary of being seen as giving Gov. Terry McAuliffe (D) any room to try to push through an expansion on his own. So even the moderates eventually went along.

Last year’s Democratic sweep of statewide races left Virginia Republicans reeling. Many blamed a party convention for producing the losing gubernatorial ticket of Ken Cuccinelli II, a conservative state attorney general, and E.W. Jackson, a fiery pastor from a tiny Chesapeake church.

One irony of the Cantor upset was that he was brought down in a primary, the nominating system favored by establishment Republicans. Still, some Republicans see a path for establishment figures.

Three days before Cantor’s loss in suburban Richmond, former Republican National Committee chairman Ed Gillespie nabbed the party’s nomination to take on Sen. Mark R. Warner (D) in November. And it happened at a Roanoke convention.

While Gillespie and Cantor are both establishment figures, the former actively courted tea party Republicans, while the latter openly tried to wrest control of the state party from them. Over the past three months or so, Cantor’s organization, led by Allen, a Richmond political consultant, has tried to use an obscure parliamentary maneuver called “slating” to prevent grass-roots activists from voting at district conventions. The Cantor camp tried in several congressional districts, with mixed results. But the optics hurt Cantor, and the effort failed spectacularly in his home district, where the majority leader was booed.

In contrast, Gillespie appears to have had more success. Over the past couple of months, he held private meetings with tea party leaders and meet-and-greet sessions with tea party supporters, submitting to pointed questioning throughout.

“I can’t ask for more,” said Nord­vig, the Richmond Tea Party chief.

“I asked him about his friendship with Karl Rove, because Karl Rove has publicly declared war on the tea party,” he said.

Gillespie responded that they are friends and work together, but that doesn’t mean he does whatever Rove says, Nordvig recalled. “He said, ‘If I have to give up my friends to get your vote, you probably ought to vote for someone else.’ That showed good character,” Nordvig said.

Gillespie spokesman Paul Logan confirmed the thrust of the exchange. As to whether there’s a contradiction between trying to please the tea party and a broader swath of Virginians, Logan said: “No.”

“He’s as comfortable talking to tea party activists in Danville as he is talking to entrepreneurs in Northern Virginia,” Logan said.

Whether outreach and other bridge-building can make a big enough difference in future elections is unknown.

Virginia Republican Party Chairman Pat Mullins said what happened to Cantor ultimately was a product of his particular job. As majority leader, he didn’t spend as much time in his district as he might have and that may have cost him dearly.

“All they know is they didn’t see Eric this year at that parade,” Mullins said.