In the last couple of weeks of the Virginia gubernatorial race, Ken Cuccinelli ll didn’t suddenly become a better candidate. Governor-elect Terry McAuliffe didn’t suddenly become identified with sleazy business deals. And Cuccinelli certainly didn’t get the upper hand in ad money. What took the race from a runaway to a nip-and-tuck contest? I’d suggest it was two factors.

Virginia Republican gubernatorial candidate Ken Cuccinelli II (Steve Helber/Associated Press) Virginia Republican gubernatorial candidate Ken Cuccinelli II (Steve Helber/Associated Press)

First, despite whining from national conservatives that less-than-doctrinaire conservatives had abandoned Cuccinelli, the base came home. In the end Cuccinelli got 92 percent of the Republican vote. Libertarian Robert Sarvis’s number dropped below 10 percent as Republicans grudgingly realized Cuccinelli was the only thing standing between them and McAuliffe. The problem is there aren’t enough Republicans in Virginia. And that is the lesson the GOP right wing must come to terms with: They can’t simply retain GOP votes. They must expand to moderate voters (whom Cuccinelli lost by a margin of 56 to 34 percent) and make inroads in suburban areas (Cuccinelli lost voter-rich Fairfax County by 20 points).

The other explanation for the narrowing of the race is that the context changed dramatically. The national media (felt very directly in Virginia) went from focusing on extremist Republicans and the shutdown to Obamacare and the blunders of big government. Cuccinelli finally made the pivot to that issue and it paid off. Had any plain-wrap Republican been on the ballot, there is little doubt he could have ridden the anti-Obamacare wave to victory. And had there not been a shutdown, to which Cuccinelli was tied, he might not have fallen so far behind. In the context of 2014, when the Democrats who pushed through Obamacare will be on the ballot, there will likely be no more effective issue for Republicans.

In another sign of the backlash against GOP extremists, the business-backed Bradley Byrne beat the tea party gadfly Dean Young, a Ted Cruz acolyte and incendiary speaker, by five points in a special congressional primary race. In Alabama. Main Street Republicans finally woke up:

But after the shutdown, establishment Republicans say they’re increasingly  likely to invest in primaries, too. And the Alabama race – pitting a  business-friendly former state legislator and flame-throwing tea party figure –  was a perfect playground.

“It’s become plainly obvious that staying out of primaries is not a good strategy. You have to play aggressively,” said David French, the chief lobbyist for the National Retail Federation. “I think you’re going to see more of that in the 2014 cycle.”

“We’re in this for the long haul,” he said, “and we’re looking for ways that we can be more effective in the future.”

Congressmen and senators who imagined they had free rein to wander far to the right now may face primary challenges or general election defeats at the hands of even flawed centrist Democrats like McAuliffe. If Republicans get their act together for 2014 and 2016, we may look back at the 2013 election as the point when they stopped digging their own grave.