After leading in the Virginia governor's race by double digits in recent polls, Democrat Terry McAuliffe defeated Republican Ken Cuccinelli by a mere 2.5 percentage points. This despite having outspent Mr. Cuccinelli by $34 million to $20 million.
The Republican did not lose because he ran a lousy general election campaign. His was a disciplined effort focused on jobs, Mr. McAuliffe's checkered business career and, in the closing days, ObamaCare's incompetent implementation and the law's negative consequences for Americans.
Mr. Cuccinelli was an electoral victim of the ill-devised strategy some Republicans employed to shut down the federal government unless ObamaCare was defunded. Virginia has more than 300,000 federal employees and retirees, plus a large military presence, making it particularly sensitive to a shutdown.
As Cuccinelli campaign strategist Chris LaCivita told the Washington Post on Nov. 2, the campaign spent early October "debating the shutdown and not theObamaCare fight." After the shutdown, the disastrous rollout of the Affordable Care Act took center stage—and Mr. Cuccinelli began closing the gap. Following Mr. Cuccinelli's concession speech, Mr. LaCivita mused to the Washington Post, "I can't help but ask myself, what would have been the result had he had five weeks of this discussion instead of just 2½?"
Mr. Cuccinelli's loss is also attributable to factors out of his control, and to his actions in the years leading up to the race. Incumbent (and term-limited) Republican Gov. Bob McDonnell ran into serious ethics problems surrounding unreported loans and gifts from a wealthy investor. That prevented the once very popular governor from being able to raise money and votes for Mr. Cuccinelli.
Then there was Mr. Cuccinelli's reputation. In the state senate and as attorney general, he was well known for his conservative social views. His positions weren't the problem. It was the way in which he has presented them for years—with polarizing language and an acerbic tone that even allies found off-putting.
While he played down social issues this election, he could not escape his past words on abortion, birth control and divorce laws, especially with Mr. McAuliffe lambasting him relentlessly with negative television ads whose tagline was: "He's focused on his agenda, not us."
The contrast with Mr. McDonnell is instructive. As a legislator and attorney general, Mr. McDonnell was equally conservative on social issues, but he advocated them in a way that won respect and encouraged civil discussion. As a result, he won 54% of women four years ago (compared with 42% for Mr. Cuccinelli) and 66% of independents (compared with 47% for Mr. Cuccinelli on Tuesday).
Mr. Cuccinelli also made a mistake in engineering a last-minute change to have the GOP's gubernatorial candidate chosen in a convention rather than a primary. Roughly 8,000 Virginians attended this year's Republican State Convention. By comparison, 255,997 Republicans voted in last year's U.S. Senate primary. Mr. Cuccinelli won more than 92% of Republicans who turned out Tuesday—but the GOP's share of the electorate dropped to roughly 32% this year from 37% four years ago. Part of the reason is that the party was deprived of a primary that would have energized activists and donors.
The switch to a convention also robbed Mr. Cuccinelli of the opportunity to use a statewide primary to shape a more positive image for the general election. It saddled him with a running mate, Rev. E.W. Jackson, who made a terrific convention speech but escaped the vetting a primary would have provided. That would have revealed his string of bad debts and controversial statements that hurt the entire ticket once they were exposed in the general election.
The convention fallout also left Mr. Cuccinelli vulnerable to a libertarian candidate, Robert Sarvis, who got on the ballot with funding from a wealthy Texas Democrat. Mr. Sarvis received 6.6%, more than twice Mr. McAuliffe's victory margin. Democrats will help libertarians get on the ballot next year wherever they think it will hurt the GOP.
In the 2014 midterm elections, Republicans have many things in their favor. These include historical trends (second-term midterms for a president's party are usually difficult), Mr. Obama's crumbling job approval (39% in Tuesday's Gallup poll), and the highly unpopular health-care law.
Virginia shows that if Republicans overreach, it will hurt. A candidate's history and way of expressing his views matter. GOP candidates must unite all the party's factions—established conservatives and new arrivals, business and grass roots. Over the last several elections, Republicans have lost too many winnable races. Next year will demonstrate what lessons, if any, they have learned from that experience.
A version of this article appeared November 7, 2013, in the U.S. edition of The Wall Street Journal, with the headline Lessons for 2014 From a Virginia Defeat and online at WSJ.com.