The debate Tuesday night between presidential candidates Sen. John McCain (R., Ariz.) and Sen. Barack Obama (D., Ill.) was a close contest. But McCain managed to lose the middle class early and failed to recover strongly enough on national security which cost him a win.

The town hall format for the second of three presidential debates suited both men who were comfortable and confident with their answers in a close-up setting with average Americans.

Both candidates had fine moments. Fielding questions in a public forum can prove tricky at times. McCain faced an early challenge when a voter asked:
"Well, senators, through this economic crisis, most of the people that I know have had a difficult time. And through this bailout package, I was wondering what it is that's going to actually help those people out?"

The questioner simply wanted to understand how a bailout would help the average American. That was simple enough.

But McCain flubbed his answer in two ways. First, he had no response to how the bailout would help anyone on Main Street. Instead, he chose to blame Obama and Democrats for creating a problem by supporting mortgage giants Fannie Mae ( FNM) and Freddie Mac ( FRE).

Second, McCain completely misdiagnosed the root of the problem and the bailout. He said:
"So this rescue package means that we will stabilize markets, we will shore up these institutions. But it's not enough. That's why we're going to have to go out into the housing market and we're going to have to buy up these bad loans and we're going to have to stabilize home values, and that way, Americans, like Alan, can realize the American dream and stay in their home."

Fannie Mae and Freddie Mac were certainly hurt by falling home prices. However, the two overleveraged government-sponsored enterprises didn't engage in unscrupulous lending to unqualified buyers, like Countrywide or IndyMac. The GSEs already had been taken over by the government prior to the $700 billion bailout.

In reality, the serious errors were made by the investment bankers on Wall Street whose big bets on bad debt backfired spectacularly. Not only did those firms -- Goldman Sachs ( GS), Merrill Lynch ( MER), Morgan Stanley ( MS), AIG ( AIG) and Lehman -- package absurdly mispriced mortgage-backed securities, but they also made the mistake of ensuring them with complex credit default swaps.

The shadow financing market on Wall Street has been estimated near $60 trillion, or about four times the size of the entire American economy. This dwarfs the portfolio held by the two GSEs of about $5 trillion.

These risky transactions transfixed the credit markets worldwide. McCain had no clue how to describe this in the bailout or how to cure it.

Obama, on the other hand, explained it accurately. Addressing a questioner, he said:
"Right now, the credit markets are frozen up and what that means, as a practical matter, is that small businesses and some large businesses just can't get loans. If they can't get a loan, that means that they can't make payroll. If they can't make payroll, then they may end up having to shut their doors and lay people off."

He went right to the heart of how our system works. Credit feeds the economy by funding businesses that in turn create jobs for Americans - no credit, means no business. This is bad for everyone.

Obama recognized the problem on Wall Street as deregulation and tried to address it:
"Sen. McCain, as recently as March, bragged about the fact that he is a deregulator. On the other hand, two years ago, I said that we've got a sub-prime lending crisis that has to be dealt with. I wrote to Secretary Paulson, I wrote to Federal Reserve Chairman Ben Bernanke, and told them this is something we have to deal with, and nobody did anything about it. A year ago, I went to Wall Street and said we've got to re-regulate, and nothing happened."

Obama's simple explanation of the problem and an understanding of the remedy helped him to allay fears of his inexperience.

Whenever McCain has made a misstep in the campaign, he often bounces back with his strong suit - national security. However, Tuesday night he committed a strategic error. While discussing his judgment on when to use the military, he left Obama an opening in his flank:
"So we are peacemakers and we're peacekeepers. But the challenge is to know when the United States of America can beneficially affect the outcome of a crisis, when to go in and when not, when American military power is worth the expenditure of our most precious treasure."

McCain in prior debates had glossed over deciding when to use force. He opened the door for Obama to criticize him on invading Iraq, which is the most credible judgment Obama has on record for foreign wars.

Thus, Obama slammed McCain:
"I don't understand how we ended up invading a country that had nothing to do with 9/11, while Osama Bin Laden and Al Qaeda are setting up base camps and safe havens to train terrorists to attack us. That was Sen. McCain's judgment and it was the wrong judgment. When Sen. McCain was cheerleading the president to go into Iraq, he suggested it was going to be quick and easy, we'd be greeted as liberators. That was the wrong judgment, and it's been costly to us."

In tough battle, small mistakes are amplified. McCain stumbled on the economy and failed to outmaneuver Obama on national security. He has another chance to win the war if he can soundly defeat Obama in next week's debate in New York.