Musharraf’s successor as military chief will need all the skill he can muster—and on several fronts at once. The Pentagon wants him to turn much of Pakistan’s military into a counterinsurgency force, trained and equipped to combat Al Qaeda and its extremist supporters along the Afghan border. As a civilian head of state, Musharraf will need a strong, capable top officer who can revive the fighting spirit of a badly demoralized Army. In the past two months, suicide bombers have relentlessly attacked Army convoys, camps, mess halls and mosques. The extremists have killed more than 200 Pakistani soldiers, and tribal militants have captured more than 250 others as hostages. “The Army has had its butt kicked in the tribal area,” says the Western military official. “But I’m optimistic that if Musharraf’s choice is Kiyani, he can start to turn the Army around.”

Those who know Kiyani say he’s a smart, tough, talented commander—and pro-Western, in the bargain. The son of an Army NCO, he climbed rapidly through military ranks. In 2003, when members of the armed forces were implicated in two assassination attempts against Musharraf, the president put Kiyani in charge of the investigation—and applauded the way he got the country’s rival intelligence services working together for a change. “When Kiyani got tough, the problems of coordination disappeared and the agencies started working like a well-oiled machine,” Musharraf recalls in his memoir, “In the Line of Fire.” Within months Kiyani had unraveled the two plots and arrested most of the participants. He was rewarded in 2004 with a promotion to chief of ISI, and the next year his agency scored big with the arrest of Abu Faraj al-Libbi, the senior Qaeda lieutenant who masterminded the attempts on Musharraf’s life. A former U.S. intelligence official who dealt personally with Kiyani says the ISI “took a lot of bad guys down” under his leadership. Kiyani has earned his boss’s confidence, even serving as Musharraf’s personal envoy in recent talks with exiled opposition leader Benazir Bhutto.

Kiyani is a chain smoker with a tendency to mumble, but he speaks to Musharraf in a way few other senior officers would dare. Western military officials say he told the president he would accept nothing less than the top job in the Army—and Musharraf dreads giving up that post, knowing it is the source of much of his authority. For months the president, who himself seized power in a bloodless military coup nearly eight years ago, has resisted public demands that he step down as Army chief. His refusal has seriously raised public hostility toward the armed forces; if Kiyani succeeds in restoring its reputation, he is likely to get the credit, not Musharraf. “The Army has ruled the country for more than half of our 60 years of independence, so psychologically people are geared to the Army chief as being the political center of gravity,” says retired Lt. Gen. Talat Masood. “Musharraf’s power will be reduced considerably as people gravitate more to the new Army chief than the president.”

Right now an improvement in the public’s opinion of a Musharraf-less Army is the least of the president’s worries. He desperately needs to restore stability to the country’s jihadi-dominated areas. More than 100 pro-Islamabad tribal elders have been assassinated in the past year or so, and there are almost daily beheadings of one or two tribals accused of being government spies and collaborators. If you can’t protect your friends, you lose. An old military man like Musharraf should know that.