Who can dig us out of this?

This week’s financial implosion has shifted attention away from foreign policy in the presidential contest.

Neither candidate has been inspiring in this arena. But we have only two choices. So who can best dig America out from the mess President Bush’s foreign policy has made?

John McCain is campaigning on experience; one can only wish Barack Obama had more. Yet the next president will confront global challenges far different from those with which the aging Arizonan is familiar.

The next president must be sufficiently agile and open-minded to adjust to a rapidly changing world in which America is no longer the dominant power. So who is the foreign-policy candidate of change?

At last week’s foreign-policy debate, McCain focused obsessively on Iraq. He still insists Iraq is the central front in the war on terrorism, and he slams Obama for not agreeing. McCain doesn’t seem to grasp that the biggest threats to America now come from elsewhere.

It’s understandable that Iraq holds McCain’s attention. He was formed by the Vietnam War and the belief that we could have won there had we stayed. But that was then, in a Cold War world, and this is now.

Even on Iraq, McCain seems strangely dated. Yes, McCain supported the surge and Obama didn’t. And, yes, the surge “worked” because of Gen. David Petraeus’ brilliant strategy, based on backing Sunni militias that had turned against al-Qaeda. Without those Sunnis, the surge never would have succeeded.

Yet, right now, Iraq’s Shiite-led government seems poised to break up the Sunni militias and put many of their men in prison _ or kill them. Not much from McCain about that.

Then there is the bigger picture. McCain backed the Iraq war based on Bush’s mistaken strategic premise _ that it would remake the Middle East in our favor. Instead, our Iraq war vastly strengthened Iran, now the close ally of Baghdad. Our policies made Iran the strongest power in the Mideast.

As Obama points out, the Iraq war distracted us from pursuing al-Qaeda and other jihadi groups, which have now taken over parts of nuclear-armed Pakistan and are threatening Afghanistan.

McCain is guilty of the very sin for which he denounces Obama: confusing strategy with tactics. Yes, we ousted Saddam Hussein, but in doing so we left ourselves less secure in our primary battle, with jihadis _ whose central front is not in Iraq.

Despite his many trips to Iraq, McCain shows little grasp of the current situation in Baghdad. He talked of coming home “with victory and with honor”; he has speculated that we could keep troops in Iraq for many years, as we have in Germany and Japan. But this vision shows little understanding of present-day Iraq.

Shiite officials tell me their leading cleric, Ayatollah Ali Sistani, has specifically ruled out the German or Japanese model. Iraq is an Arab Muslim country that remembers colonial occupation.

Few Americans realize that Iraqi Prime Minister Nouri al-Maliki has virtually endorsed Obama and insists that all U.S. troops be out of his country by the end of 2011. Maliki has been stonewalling on an agreement that would enable U.S. troops to remain after a U.N. mandate expires in December.

Perhaps this agreement will be signed, perhaps not. The foreign minister of Iran, Manouchehr Mottaki, told me, “Iraq will not sign,” and Tehran has plenty of influence on Maliki.

I’ve opposed Obama’s 16-month timeline as too fast, because I fear Iraq’s civil war will reignite. Obama would probably have to slow it down if he were elected.

Yet the Iraqi government may force the next U.S. president to pull troops out even faster than Obama now wants. McCain seems unaware that Iraqis are showing a mind of their own.

McCain is equally out of touch on Iran. He sneers at Obama’s point that we need to try unconditional talks.

Yes, Obama tripped himself up in his early proposal to talk to President Mahmoud Ahmadinejad, but he has backed off that mistake. The Illinois senator was right to point out that Henry Kissinger agrees on the need for such talks with Tehran; Kissinger told CNN, “I am in favor of negotiating with Iran … at the secretary of state level.”

Bottom line: Obama recognizes that the next president must think through a new Mideast strategy, whose focus is less on Iraq and more on Iran, Pakistan and Afghanistan. McCain seems stuck, unable to integrate Iraq into a broad strategy for the greater Middle East.

Mired in recession and disliked abroad, our country needs a president prepared for the new challenges we’re facing. Obama is far from perfect, but he seems more capable than his opponent of looking to the future rather than the past.