Editor's note: Peter Bergen is CNN's national security analyst and a fellow at the New America Foundation in Washington and at New York University's Center on Law on Security. His most recent book is "The Osama bin Laden I Know: An Oral History of al Qaeda's Leader."

Peter Bergen says the next president could face a key decision on Israel and Iran.

(CNN) -- Toward the end of Friday's presidential debate, the conversation turned to Iran and there was a long back-and-forth between the two candidates about what kind of conditions should be set for any discussions with the Iranian government.

But neither addressed what could be the most important foreign policy issue either might face as president: a unilateral strike by Israel against Iranian nuclear facilities.

Israeli officials are clearly seriously contemplating such a strike, as Iran is believed to be drawing near to having a nuclear capability that those officials believe poses an existential threat to Israel.

Such a strike would probably immensely complicate U.S. efforts in both Iraq and Afghanistan as the Iranians would probably retaliate against American targets in both countries after such an attack.

During the next debate, each candidate should be asked, "If you receive intelligence or warning that Israel is about to strike Iran's nuclear facilities, what would you do?" Sorting out the correct American policy in such an eventuality is exactly the tough kind of call that will help define the next president.

The wars in Iraq and Afghanistan both play to some of the key strengths and weaknesses of Sens. Barack Obama and John McCain.

McCain, of course, was a strong proponent of the Iraq war, and as the country devolved into anarchy, he also became an outspoken supporter of "the surge."

Obama opposed both the Iraq war and later the surge, and his opposition has, in part, revolved around the fact that the Afghan war is still unfinished business, as is the fight against al Qaeda.

And so, as was to be expected when Iraq took center stage in Friday's debate, McCain emphasized the success of the surge and the new counterinsurgency strategy overseen by Gen. David Petraeus, while Obama needled McCain for largely ignoring the failures and costs of the Iraq war between 2003 and 2007.

Lost in this discussion was the fact that while the surge of some 30,000 American soldiers certainly put more American boots on the ground in neighborhoods from Anbar province to Baghdad to "clear, hold and build" them and was clearly an important element in the sharp decline in violence in the country, there are several other key underlying factors that tamped down the mayhem in Iraq that neither of the candidates addressed:

• First, the appearance in 2006 of the various "Awakening" movements, in which Sunni tribes once allied with al Qaeda turned against it.

• Second, the implementation of the Sons of Iraq program consisting of some 100,000 Sunni militants, many of whom used to be shooting at American soldiers, who are now on the U.S. payroll. Now that's a surge!

• Third, the previous ethnic cleansings in Iraq and the millions of Iraqi refugees who have fled their homes, meaning there are fewer potential targets of sectarian violence.

• Fourth, the large size and increasing efficacy of the Iraqi army and police, some 550,000 strong, who are now beginning to operate with some level of professionalism.

• Fifth, the increasingly nonsectarian approach of Nuri al-Maliki, the Shia prime minister, who has taken on Shiite militias in Basra and Sadr City, an important signal that the government will act in something like the national interest.

• Sixth, the cease-fires ordered in the past year or so by the leader of those Shia militants, the cleric Muqtada al-Sadr, whose position in Iraq has weakened significantly since 2007.

These underlying factors made the surge a force multiplier for the fragile peace we are seeing today in Iraq. And now that the surge is over, it is those factors that might ensure that the fragile peace holds, yet neither Obama nor McCain discussed how these factors might change their own Iraq policies going forward.

A missed opportunity in the debate was also to hear from each candidate some specifics about his plans for the size of the future U.S. military presence in Iraq.

McCain, who once famously said that the United States could be in Iraq for a century if American troops weren't being injured or killed there, never explained in the debate how he plans to ramp up significantly the number of American soldiers in Afghanistan -- something he has promised to do, at the same time that he continues to favor a continuing substantial U.S. presence in Iraq.

As Obama noted during the debate, the chairman of the Joint Chiefs of Staff, Adm. Mike Mullen, has said that given the present commitments in Iraq, it is just not possible to now send thousands more American soldiers to Afghanistan.

For his part, Obama was not asked about the specifics of his plan to withdraw from Iraq in 2010 yet at the same time maintain what he has frequently termed a "residual force" there that would handle key missions such as counterterrorism.

According to military officials I have spoken to, such a residual force tasked with counterterrorism, intelligence gathering on the ground, providing tactical support to Iraqi military operations and protecting U.S. facilities such as the largest American embassy in the world would consist of four to eight brigades.

Depending on the exact size of those brigades, that could mean up to 40,000 American soldiers based in Iraq for many years to come. For obvious reasons Obama has never spelled out what he estimates his residual force in Iraq would look like, as to do so would alienate the liberal, Moveon.org wing of his party, which is laboring under the delusion that come 2010, if Obama is in the White House, there will be no U.S. troops in Iraq.

Obama was on firm ground when he attributed the deteriorating situation in Afghanistan to the diversion of American resources to Iraq. This is uncontroversial.

The initial U.S. deployment to Afghanistan was the smallest peacekeeping force, per capita, that America has sent anywhere since World War II, while a RAND study found that, "Afghanistan has received the least amount of resources out of any major American-led nation-building operation over the last 60 years."

And today, there are four times more U.S. soldiers in Iraq than in Afghanistan, a country that is significantly larger in terms of both size and population.

The opinions expressed in this commentary are solely those of the writer.

All About Israel • Iran • John McCain • Barack Obama