David Petraeus knows Iraq and he's learning Afghanistan. But the biggest test facing the four-star general as he takes charge of Central Command is probably Pakistan — threatened with financial ruin, torn by an Islamic extremist insurgency and armed with nuclear weapons.

Although most of the troops under his command are in Iraq or Afghanistan, Petraeus plans to visit Pakistan on his first trip after being sworn in Friday as the Central Command chief. Pakistan's leaders are struggling to balance their own domestic pressures with Washington's demands that they do much more to stamp out Taliban and al-Qaida havens in the tribal areas bordering Afghanistan.

Defense Secretary Robert Gates is to preside at the change-of-command ceremony at Central Command headquarters along the shores of Florida's Tampa Bay. Less than two months ago Gates was in Baghdad to see Petraeus hand off to Gen. Ray Odierno as the top American commander in Iraq.

Petraeus spent 20 months leading a turnaround in Iraq, from what many saw as the brink of all-out civil war to the beginnings of a perilous peace. He also led troops in the initial invasion in 2003 and spent more than a year heading the organization responsible for training Iraqi security forces.

Iraq will be a key part of Petraeus' broader responsibilities at Central Command, which manages U.S. military relations with nearly two dozen countries in an area stretching from Egypt, across the Middle East to Central Asia. The region is at the heart of the American-led war on terror.

Petraeus is fond of saying that the struggle in Iraq has been long and hard — and is not yet finished. And he has said that the war in Afghanistan is likely to prove an even longer and harder struggle.

But Pakistan presents a whole different dimension of difficulty, as captured by Adm. Mike Mullen, chairman of the Joint Chiefs of Staff, when he said in June that any future terrorist attack on the United States probably would originate in Pakistan's western tribal regions. So while prevailing in Iraq and Afghanistan are considered important, Pakistan may pose a bigger immediate threat.

"Dealing with Pakistan, where America's mortal foe al-Qaida is nestled alongside the Taliban, is clearly the most pressing problem we face," Bing West, a retired Marine and former assistant secretary of defense, wrote in National Interest, the journal of international affairs and diplomacy.

Although he'll have no ground troops in Pakistan, other than a very small number performing behind-the-scenes tasks like training Pakistani troops, Petraeus has already made clear that he sees it as a war front. In a sense it is an extension of the war in Afghanistan, now in its eighth year.

The al-Qaida network led by Osama bin Laden — driven out of Afghanistan by U.S. forces in 2001 after the Sept. 11 attacks on New York and Washington — has managed to develop closer ties to Pakistani militants, providing the terrorists with safe bases in the mountainous tribal areas along the border. That has led to more cross-border attacks on American and U.S.-backed Afghan forces, prompting the Bush administration to send more troops and to review its overall strategy.

Petraeus has been studying how he might apply some of the counterinsurgency tactics from Iraq to the war in Afghanistan. And he has made clear that Pakistan will likely be a different case altogether.

"Pakistan is going to do this on their own," he said at the Heritage Foundation on Oct. 8. "They have a very keen sense of sovereignty."

In an interview in Washington this week, a senior Pakistani official said his government is crafting a more comprehensive strategy for fighting the insurgency, which is now regarded as the gravest threat facing the government. It will be carried out in cooperation with the U.S., but not on a U.S. timetable, the official said, speaking on condition of anonymity because of the sensitivity of the issue.

"We are going to run this," the official said.

How much patience the next U.S. president will have to wait for Pakistan's plan to bear fruit will be a key question. In recent months the Bush administration has accelerated the use of unmanned aircraft to attack known or suspected insurgent targets in remote border areas inside Pakistan.

Petraeus arrives at Central Command with what might be seen as an extraordinary burden of high expectations, after his achievements in Iraq and his emergence as trusted voice on war strategy.

He almost didn't arrive at all. Gates originally figured he would move Petraeus from his Baghdad post to the less stressful job of commanding U.S. and NATO forces in Europe. But when Adm. William Fallon abruptly and unexpectedly announced in February that he was retiring after just one year heading Central Command, Gates switched gears and decided he needed Petraeus in that post.

Since late March, when Fallon stepped down, Lt. Gen. Martin Dempsey has filled in as acting commander of Central Command. He returns to his previous slot as deputy commander and later will move to command U.S. Army Training and Doctrine Command, a four-star position.