Editor's note: Julian Zelizer is a professor of history and public affairs at Princeton University. He is the author of "Jimmy Carter" and of the new book "Governing America."
(CNN) -- President Barack Obama must do well in the debate Monday or he risks losing the national security advantage that Democrats have struggled so hard to regain.
Obama was able to ward off Mitt Romney's attacks about Libya in the second debate, when Romney tripped up on one word, "terror," which contradicted the public record. But tonight, the Republican will have 90 minutes to take on the president's national security program in more systematic fashion. With last week's capture of a terrorist who was planning to bomb the New York Federal Reserve and a brutal bombing of civilians in Syria, national security issues are heating up.
Democrats stand a lot to lose.
For several decades, the public trusted Republicans on the issue of national security. Since Vietnam, Republicans hammered away at Democrats as being weak on defense and unwilling to do what was necessary to protect the nation. In 2004, President George W. Bush eviscerated his opponent, Massachusetts Sen. John Kerry, with this argument. Though Kerry began the Democratic Convention by highlighting his credentials as a Vietnam veteran, the Republicans developed an entire campaign around the question of whether Democrats could be trusted to prosecute the war on terrorism.
For all of Obama's struggles with the economy, Democrats have made huge strides in the past six years.
The reversal of partisan fortunes began toward the end of George W. Bush's presidency, when the White House was struggling to avoid total chaos in Iraq, a war that was highly unpopular. Democrats took control of Congress in the 2006 elections, partially in response to Bush's decision to go to war in Iraq and his handling of it. In the 2008 presidential election, Obama made Bush's war a centerpiece of his campaign. He promised to bring the war to an end and to reverse those components of the war on terrorism that had violated civil liberties.
The strategy was successful.
As president, Obama continued to neutralize many of his critics. He left intact most of Bush's counterterrorism program, in some cases intensifying operations such as drone airstrikes against al Qaeda, and he made it difficult for conservatives to say that he was not doing enough. After Osama bin Laden was killed by special operations forces, even Republicans had to praise the courageous operation. Obama accelerated the war in Afghanistan and brought the controversial war in Iraq to a close.
While many on the left have been frustrated that Obama retained so much of the status quo, politically the president positioned himself as the person who was tougher on defense.
During the Democratic Convention, he railed against Romney for having failed to salute the troops in his acceptance speech and for a series of embarrassing gaffes that took place when Romney traveled overseas this summer. In September, Pew found that 53% of those surveyed trusted Obama to make wise decisions on foreign policy, compared with 38% for Romney.
But in recent weeks, the advantage seems to be eroding.
The outbreak of violence in the Middle East and the White House's contradictory statements about a deadly al Qaeda attack at the U.S. Consulate in Benghazi, Libya, have opened up space for Republicans to go after the administration on this front. Vice President Joe Biden's statements during his debate against Paul Ryan that neither he nor the president knew about security threats, along with Secretary of State Hillary Clinton taking responsibility, certainly did not help.
Sen. John McCain, R-Arizona, told Fox News, "I think it's very laudable that she should throw herself under the bus. But first of all, responsibility for American security doesn't lie with the secretary of state. It lies with the president of the United States. It's either willful deception or a degree of incompetence and failure to understand fundamental facts on the ground. ... Either one of those is obviously totally unacceptable."
Obama has tried to push back against all of this criticism, including his statement in the second debate that he himself has ultimate responsibility, but the Republicans' singular attacks have continued nonetheless.
Administration officials must be careful if they think there is no risk.
Aside from 2008, there are many years in which parties lost their advantage on national security. In 1952, Democrats still thought of themselves as the party that had won World War II and set up America's Cold War strategy against the Soviet Union. Republicans hit back when Adlai Stevenson faced off against Dwight Eisenhower, a World War II military hero. Republicans attacked Democrats for being weak on fighting communism, for a military stalemate in Korea and for having allowed China to fall to communism in 1949. Eisenhower won the presidency, and Republicans took control of Congress.
Just a few years later, Republicans saw their advantage slip away. Though Eisenhower was an immensely popular president and one who, as Evan Thomas shows in his masterful new book "Ike's Bluff," demonstrated immense skills at diplomacy, John F. Kennedy ran as more of a hawk than Eisenhower's vice president, Richard Nixon, did in 1960.
He built on arguments that Democrats had made in the 1950s, that Republicans were so focused on balancing the budget they were not spending enough on defense to win the presidency.
"Our security," he said, "has declined more rapidly than over any comparable period in our history -- in terms of defensive strength and retaliatory power, in terms of our alliances, in terms of our scientific effort and reputation."
Republicans struggled again in 1992 when President George H.W. Bush watched as his advantage, which had apparently been cemented with the successful Operation Desert Storm in 1990-1991 that resulted in the expulsion of Iraqi forces from Kuwait, slip away.
While Bush did not devote enough attention to the economy, it was also Saddam Hussein's continued military attacks on his opponents in U.N. cease-fire zones that seemed to demonstrate Bush's victory had been incomplete.
"It's like any other bully," presidential candidate Bill Clinton said then, "you send 'em mixed messages, they'll take advantage of you every time."
The politics of national security is tricky, and uncontrollable events can easily push politics in a different direction. Obama will have to answer some of the tough questions that have emerged, and this time Romney is going to be prepared to handle them more effectively and to show that his overall agenda still offers the U.S. the best path forward.
Monday's debate can have a big impact, not just on the outcome in November, but on how the public thinks about whom they should trust when it comes to national security.
The opinions expressed in this commentary are solely those of Julian Zelizer.