YOU COULD practically hear elated Virginia Republicans doing backflips in their kitchens last spring when the Democrats picked Terry McAuliffe to run for governor — a candidate so flawed, so insubstantial, so unversed in state government and so tainted by decades of shady dealings that he would simply collapse in the heat of an election, handing the GOP a victory tied up with a red bow. “One good statewide ad campaign could define McAuliffe before this race even starts,” National Review Online wrote in April.

Who knew that Mr. McAuliffe, the most prolific campaign fundraiser of his generation, would have so much money or that he’d use some of it on negative advertising?

No fair! That’s the cry from some Republicans, especially tea party acolytes of Ken Cuccinelli II, the GOP candidate who lost narrowly Tuesday. In a spilt-milk snit, they are crying foul. A sulking Mr. Cuccinelli has refused to make the traditional call to congratulate Mr. McAuliffe on his victory.

It may be news to the tea party, but politics can be rough. The vicious and negative ads, statements and news releases flew in both directions, every day, for months. Yes, Mr. McAuliffe, who raised $34 million, outspent Mr. Cuccinelli by $15 million. His fundraising prowess cannot have come as a surprise to the Cuccinelli camp; Mr. Cuccinelli’s lesser haul in turn resulted in part from his position on the far right of the Republican spectrum.

We’re not in the business of offering advice to political parties, but we do believe that the two-party system has produced good governance for Virginia and is worth retaining. So it’s worth saying this to Republicans: If they wish to remain a viable political force in a moderate, purple state, they should take the right lessons from Tuesday’s defeat.

That means, first and foremost, that they should avoid the easy trap of concluding that Mr. Cuccinelli was the victim of money, serendipity, circumstances, foul play or inclement political head winds. Fundamentally, what caused Tuesday’s Republican wipeout was Mr. Cuccinelli himself and the record he compiled — a clear, consistent right-wing agenda forged over a decade in Richmond.

The Cuccinelli record had nothing to do with job-creation or the state’s economic well-being or alleviating deepening transportation problems, all of which are central to Virginians’ well-being. It was mainly about bashing homosexuals, harassing illegal immigrants, crusading against abortion, denying climate change, flirting with birthers and opposing gun control. A hero to the tea party and a culture warrior of the first rank, Mr. Cuccinelli lost because he was among the most polarizing and provocative figures in Richmond for a decade. That made him the wrong candidate for Virginia.

The GOP-inspired government shutdown did not help matters for Mr. Cuccinelli. Nor did Gov. Robert F. McDonnell’s ethics problems (which also ensnared Mr. Cuccinelli).

In a purple state, Mr. Cuccinelli captured the GOP nomination on the strength of support from like-minded stalwarts on the party’s fringe. Nominated in mid-May, he trailed in every poll after June. The battle for the middle ground, and for Virginia’s rich crop of swing voters, was decided early in Mr. McAuliffe’s favor. Mr. Cuccinelli, despite valiant efforts, could never escape his own record.