Editor's note:Julian E. Zelizer is a professor of history and public affairs at Princeton University. He is the author of "Jimmy Carter" by Times Books and editor of a book assessing former President George W. Bush's administration by Princeton University Press.

With the midterm elections just a week away, many Democrats are scratching their heads and wondering what went wrong.

After Barack Obama's election in 2008, many in the party thought that they were on the cusp of a new era in American politics. Republicans, and the conservative philosophy that had shaped their party for several decades, seemed to be in retreat.

Yet less than years later, Republicans are on the verge of recapturing control of the House of Representatives and maybe the Senate. President Obama's approval ratings have slid since his first year, while Republicans are now looking forward to the election of 2012.

The most conventional argument about what went wrong for Democrats is that Obama moved too far to the left in a country that is center-right. But this argument is not supported by a recent study by The Washington Post, Henry Kaiser Family Foundation and Harvard University.

The study found that Americans are philosophically conservative but operationally liberal. While they do express strong distrust of government in general, when asked about specific programs they usually voice their support. More Americans have more negative views of government than they did 10 years ago, yet most people still consider Social Security and Medicare to be "very important" and almost half support government regulation of health care.

Democrats were knocked down by a different set of factors besides some broad philosophical disconnect between the party and the people. The first is the most obvious: the economic downturn.

When the economy is in the kind of poor shape that it is today, the party in power usually does badly in elections. There are exceptions, such as 1934, when Democrats expanded their majority despite the dire state of economic affairs. But normally downturn elections look more like 1958 when Republicans suffered huge setbacks as a result of the recession.

The second factor is that Obama has not performed very well as a party leader, even as he succeeded in obtaining a good deal of his presidential agenda from Congress. In this respect, there are some similarities between Obama and President Carter, who left his party in worse political shape in 1981 than when he found it.

Heeding Rahm Emanuel's admonition that politicians should not let a crisis go to waste, the administration pushed for a number of hugely controversial measures in the first two years. Most significantly they pursued health care reform and financial regulation.

With their victory on both issues came significant political costs. Obama placed many congressional Democrats, whom he called on to vote for these measures, in a difficult position with their constituents. The bills were certain to trigger fierce opposition, and they did. Moreover, the structure of health care legislation delayed the start of most benefits until 2014.

Without economic recovery, congressional Democrats have been left with a controversial record and an angry electorate.

Further straining the party was the fact that the administration did not do a good job at keeping liberals enthused and engaged. The president made a series of crucial compromises such as dropping the public option from the health care bill and only offering tepid support to gay rights, while sometimes going out of his way to antagonize liberals.

Press secretary Robert Gibbs has served as an attack dog, not against Republicans but instead against members of his own party such as when he vented about the "professional left."

The final factor has been the strength of the opposition. Republicans have pulled off a remarkable recovery since 2008. Within Congress, House Minority Leader John Boehner and Senate Minority Leader Mitch McConnell have maintained tight discipline. Even in the worst of times, few in the GOP crossed over to the other side of the aisle.

Outside of Capitol Hill, Republicans put together a powerful combination of Washington-based organizations, grass-roots activism and internet-based operations that re-energized the conservative movement financially and organizationally.

Although it is unclear how many Tea Party candidates will win, the citizens who participated in the movement have injected a level of energy and excitement about the GOP that had vanished under President George W. Bush.

Conservatives have also done very well at playing the politics of the media by staying on message and framing Obama and his policies in a negative light. They have been able to turn the president's legislative victories into political defeats. Obama and his supporters have spent the last few months trying to explain all that he has done. But when a president has to do so much explaining, that means that he has already lost the battle.

Whatever the outcome of the midterms, Democrats will need to regroup in the coming months. Rather than focusing on allegations of foreign money flowing into the campaign or embarking on some wholesale philosophical shift to the right, Democrats would do better to look at the specific strategic mistakes that they have made along the way and make sure that they don't repeat them on the road to 2012.

The opinions expressed in this commentary are solely those of Julian E. Zelizer.