President  Obama returns to the White House from a ceremony for the transfer of the remains of Ambassador Christopher Stevens and three other embassy employees who were killed when the consulate in Libya was attacked.

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.”

Story highlights

Julian Zelizer: Events have pushed foreign policy to front of campaign

Zelizer: Turmoil in North Africa, Middle East could affect election's outcome

International issues helped Eisenhower in 1956, Zelizer says

Zelizer: Carter lost ground in 1980 after the surprise Soviet invasion of Afghanistan

CNN  — 

Politics has returned to the water’s edge. In the past week, we’ve seen how international events can suddenly dominate a political campaign, at least for a few days.

The uproar in the Middle East over a YouTube video that featured anti-Islamic messages triggered widespread protests. An attack on the U.S. consulate in Libya left four people dead, including U.S. Ambassador Christopher Stevens. Protests in Egypt were equally intense as some people in a crowd of more than 2,000 scaled the walls of the U.S. Embassy. Protests spread to 20 other countries in the Middle East and beyond. In Tunis, protesters destroyed a school run by Americans while in Afghanistan protesters lit with a torch an effigy of Obama, the U.S. leader once hailed as the president who would repair America’s image in the world, and watched it burn up.

Added to this brew was Israeli Prime Minister Benjamin Netanyahu’s warning that, in his mind, President Obama has refused to be tough enough with Iran on its nuclear program and the prospect that Israel could take military action against Iran on its own.

World: Where Obama, Romney stand on foreign policy challenges

Julian Zelizer

These issues immediately entered into the campaign. Speaking of the tragedy in Libya, President Obama reiterated that “We reject all efforts to denigrate the religious beliefs of others. But there is absolutely no justification to this type of senseless violence. None.”

Mitt Romney, mistakenly interpreting a statement released earlier by the U.S. Embassy in Egypt, before most of the protests, criticized the administration’s statements as “akin to apology.” Democrats complained that Romney was politicizing this tragedy. One of Obama’s campaign officials, Ben LaBolt, said “We are shocked that, at a time when the United States of America is confronting the tragic death of one of our diplomatic officers in Libya, Gov. Romney would choose to launch a political attack.”

When foreign policy crises intrude into presidential elections, they have the ability to shake up campaigns and force candidates to adjust their plans.

Sometimes foreign policy can benefit an incumbent. Republican Dwight Eisenhower, who was a military hero before becoming president, survived crises overseas in October 1956 and emerged on Election Day with a decisive victory. Eisenhower had come under criticism from congressional Democrats for being so consumed by balancing the budget that he had supported military cuts that they argued would endanger the nation.

In late October, Israeli and British forces attacked Egypt, which under President Gamal Abdel Nasser had taken over the Suez Canal and nationalized the British-owned corporation that managed the area. After the attacks on Egypt, and Soviet warnings that they would intervene, Eisenhower worked hard in public and behind-the-scenes to defuse the situation and force Britain, France and Israel to back down.

The other crisis, which also took place in late October and early November, was when the Soviets proceeded to crush a rebellion in Hungary against the communist regime. Eisenhower decided not to respond, fearing that U.S. interference could trigger a nuclear war. Democrats argued that the refusal to respond revealed that all the talk by conservatives about liberating Eastern European people was false. In Detroit, Eisenhower’s opponent, Adlai Stevenson, warned that “whatever the provocation, aggression can no longer be tolerated in the atomic age.”

But these crises only ended up bolstering the image of Eisenhower as a strong commander in chief who could coolly guide the nation through crisis. The president coasted to re-election with 457 electoral votes and 57.4 percent of the popular vote.

But on other occasions, a foreign policy crisis greatly damaged the incumbent. In December 1979, the Soviet Union invaded Afghanistan. The invasion, which took President Carter by surprise, played into the hands of Republicans, who were arguing that the White House didn’t know how to handle these kinds of situations.

Even though Carter responded to the Soviets by calling for higher levels of defense spending and announcing a buildup of forces in the Persian Gulf, Republicans accused him of doing too little too late.

With U.S. hostages already being held in Iran, Ronald Reagan and other conservatives pointed to this as more evidence that Carter could not be trusted as leader. The Republican National Committee said that the “policy of patience” from Carter was the “policy of weakness.” While this was certainly not the sole issue that handed Reagan his victory, it played an important role in pushing the electoral map in favor of the Republicans.

What will happen if the current crises continue or get even worse? For President Obama the risks are very clear. If the situation deteriorates, these hot spots will offer the GOP evidence that the president is not an effective leader. Republicans will argue that this proves all the talk about the successes of his foreign policy record is overblown. The danger is particularly acute with Libya and Egypt, two countries that have been described as relative success stories in the Obama era of foreign policy since autocratic leaders were overthrown. These crises will also force the president to devote more attention to working in the Oval Office rather than spending time on the campaign trail.

The risks are also great for Mitt Romney. The crises could easily benefit Obama just as they did Eisenhower.

Anything having to do with overseas issues takes attention away from the economy, the area where Obama is most vulnerable.

Opinion: What if U.S. stops policing the world?

As was evident in their convention, Democrats feel they now have the so-called national security advantage. The successful drone strikes against al-Qaeda, as well as the death of Osama bin Laden, have given the White House a foundation from which to say the president is better prepared to handle these challenges.

Mitt Romney has not helped his cause, since he made widely publicized mistakes during his trip abroad, such as insulting the British about how they were handling the Olympics and making controversial remarks asserting the cultural superiority of the Israelis over Palestinians. Then during his acceptance speech in Tampa, Romney failed to praise the work of U.S. troops in Afghanistan.

As was the case with Eisenhower, foreign policy crises, at least in the short term, can create a rally-around-the-leader effect while raising questions about whether Romney is ready for the White House.

If the crises subside, the campaign is likely to shift its focus back to what’s going on Main Street. But if not, Obama and Romney will need to calibrate their responses so that foreign policy does not pose a damaging blow to their campaigns.

Follow @CNNOpinion on Twitter.

Join us at Facebook/CNNOpinion.

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