Editor's note: Julian Zelizer is a professor of history and public affairs at Princeton University. He is the author of "Jimmy Carter" (Times Books) and of the new book "Governing America" (Princeton University Press).
Princeton, New Jersey (CNN) -- Just as Mitt Romney secured the Republican nomination, President Obama launched his presidential campaign with a weeklong celebration of his foreign policy accomplishments.
He and others in his administration blanketed the airwaves to discuss the first anniversary of Osama bin Laden's death, and the president made a surprise trip to Afghanistan to boast that he had fulfilled his promises.
The president's campaign team rolled out a controversial ad that praised Obama for having made the decision to raid bin Laden's compound and went so far as to raise questions about whether Romney would have done the same. "Which path would Mitt Romney have taken?" reads the screen, followed by quotations and news stories about Romney criticizing the hunt for bin Laden.
Only two election cycles after the GOP hammered away at Democrats for being weak on defense and incapable of handling the challenges of the post-9/11 era, Democrats in the White House are feeling confident enough to present their candidate as the person who has the more muscular foreign policy and the person who has made America safe. There are many reasons to feel this way. As Washington Post columnist E.J. Dionne noted, "The polls could hardly be clearer," with 53% of Americans polled reporting they feel more trust in Obama than Romney in dealing with international relations.
But the temptations to pound on this theme should not obscure the serious challenges the president faces in taking this path. Though Romney remains vulnerable on national security given his minimal foreign policy record and the fact that Republicans are still saddled by some of the most controversial parts of George W. Bush's foreign policy record, namely Iraq, Democrats face significant risks if this becomes a central strategy.
The first risk is that historically foreign policy is incredibly fickle. New crises can transform the politics of an issue within months, if not days, as the Arab Spring revealed. Many presidents have seen their national security advantage disappear quickly.
In 1952, President Harry Truman and the Democratic candidate Adlai Stevenson watched Republicans turn the stalemate in Korea, which followed the fall of China to communism in 1949, into a theme that undercut the political benefits from FDR's historic victory against fascism in 1945. John F. Kennedy saw how his resolution to the Cuban Missile Crisis in October 1962 helped Democrats hold on to their seats in the midterm elections, at a time when the GOP had been planning to highlight the president's failed policies in Cuba.
In 2003, President George W. Bush experienced this turnaround as well. After quick triumphs in Afghanistan and Iraq, his speech in front of a "Mission Accomplished" banner turned into a sign of weakness when the postwar battles proved difficult. Although Bush won re-election in 2004, the turn of events would severely undercut his popular standing throughout his second term.
Last week provided more examples: A few hours after President Obama's visit to Afghanistan, bombs went off in Kabul. The diplomatic incident with the Chinese activist Chen Guangcheng turned from a deftly handled situation into an embarrassing, and apparently botched, process. And this weekend's elections in Greece and France have created great uncertainty about their austerity plans and, as a result, will likely result in turbulence in international stock markets.
Other presidents have learned about the second challenge of playing the national security card, namely that in economically bad times, boasting about foreign policy can make a president look as if he is avoiding the real issues.
Nowhere was this clearer than with George H.W. Bush, who in 1991, after the decisive defeat of Saddam Hussein in Operation Desert Storm, seemed invincible. "The number of people who don't like George Bush," Newt Gingrich joked, "is almost down to the number of people running for the Democratic nomination." But as the recession worsened, Bush's desire to play up his foreign policy accomplishments made him look evasive and as if he didn't care much about domestic policy. Bill Clinton capitalized on this vulnerability with his campaign about economic policy. Bush went down to defeat.
The third vulnerability is the fact that foreign policy has been notoriously messy in the post-Cold War world. The kind of clarity that foreign policy had during the Cold War, with a clear enemy and clear areas of competition, has been gone since the 1980s.
That has been replaced by a world of foreign policy defined by amorphous terrorist networks, rogue states whose loyalties are constantly shifting and ethnic warfare in which it is difficult to distinguish the good from the bad. President Bill Clinton and Vice President Al Gore learned how difficult it was to develop political capital in this world of foreign policy. Despite a significant victory in Kosovo, where American air power helped bring down Serbia's Slobodan Milosevic, foreign policy success did little for Al Gore when he ran against Bush in 2000.
The final danger is that President Obama could turn off some of the loyal supporters who he will need to energize to come out to vote, to organize and give money to his campaign, if the polls showing a close contest are to be believed. If Obama sounds too much like a hawk and engages in the kind of predictable national security scare tactics that other politicians, including his predecessor, used, he will further erode the image he held in 2008 of being a candidate who sought to raise public policy debates to a higher level.
All these are reasons for the White House to think carefully about whether the campaign theme rolled out in the past week should be central in the coming months.
While the temptations are immense for a commander in chief who has enjoyed success to use that record as a battering ram against his opponents, the politics of national security are trickier than they seem. Very often, those who are lured into making war and peace the message of their campaign find that the decision comes back to haunt them in November.
The opinions expressed in this commentary are solely those of Julian Zelizer.