Gen. Ashfaq Kayani, the powerful head of the Pakistan Army, said Sunday he will retire at the end of November, clearing the way for Prime Minister Nawaz Sharif to select a replacement while maintaining the balance of power between civilian and military leadership.

With his term already extended once in 2010, Kayani had been widely expected for months to give up control of the country's nuclear-armed forces after six years on the job. But there had been mounting speculation that Sharif, who began his third term in June, could keep Kayani in a senior military position amid growing uncertainty about the region's future.

Pakistan is facing relentless terrorist attacks from Islamist militants, continued tension on its eastern border with India and uncertainty over the long-term stability of neighboring Afghanistan as U.S. forces prepare to withdraw next year.