Image copyright AFP Image caption Canadian-trained Gen Bajwa has commanded the elite X Corps

The appointment of Pakistan's new army chief, announced on Saturday night by Prime Minister Nawaz Sharif, had been awaited with extraordinary interest and nervousness by politicians and the public alike.

The army is the most powerful institution in the country and its chief is the most influential figure in the country.

Ultimately the appointments of General Qamar Javed Bajwa as the new army chief and General Zubair Mahmood Hayat as Chairman of the Joint Chief of Staff Committee were carried out according to seniority, and with a welcome absence of politicking.

By being the first army chief to step down on schedule in recent years, General Raheel Sharif had in fact set the tone for the smoothest transfer of military power in decades. The reshuffle comes at a sensitive time when Pakistan's relations with India are near an all-time low.

Can the army share power?

Initially at least General Bajwa is likely to pursue the same policies as the retiring General Sharif who had - perhaps more than any of his predecessors - moulded the nine Corps Commanders into a unified and pro-active team in his own image.

Media playback is unsupported on your device Media caption Pakistan's retiring army chief has been very popular - including on social media

General Sharif was eulogised and turned into a hero by the Pakistani media for his commitment to attacking terrorism. However it would be more beneficial if the power elite viewed the army's counterterrorism strategy as a long term venture that will occupy several generations of generals, rather than a one-off achievement by a single officer.

Pakistan's most powerful man steps down

General Raheel's offensive against terrorist groups in the northwest tribal areas and Karachi was an extension - albeit a more aggressive improvement - on what his predecessor General Ashfaq Kayani had achieved. Now General Bajwa has to go further and deal with the still strong remnants of terrorist groups.

However his first task must be to develop a more equitable sharing of policy and decision-making with the civilian government, with whom General Sharif was frequently at odds. Infighting between them prompted severe bouts of political and economic instability.

Image copyright AP Image caption Some Afghan Taliban like these militants have moved into Afghanistan, others remain in Pakistan

At the same time the army's criticism of Nawaz Sharif's failure to provide good governance and deal with corruption had wide public appeal and appeared to be justified. Yet Pakistan cannot stabilise its polity unless a more responsible civilian government is given greater authority over policies the army now believes are its sole prerogative.

Tackling Pakistan's extremists

The army's dominance over foreign policy means General Bajwa will have to deal with the deteriorating state of Pakistan's relations with its neighbours and the region. Two major sets of extremists remain in the country, which negatively affect relations with two neighbours, India and Afghanistan.

The first are the Afghan Taliban and its appendage the Haqqani network whose leaders remain ensconced in Peshawar and Quetta. Afghanistan, the US and Nato, which still has 13,000 troops in Afghanistan, are highly critical of the army's refusal to end this sanctuary.

Image copyright AFP/getty Image caption Tensions with India are high

Efforts to broker peace talks between the Taliban and the Kabul government last year failed. Since then Islamabad's relations with the Kabul government and even peace-seeking groups within the Taliban have drastically deteriorated.

Pakistan needs to reassess its Afghan policy with the primary aim of winning back the trust of all parties and then allowing a neutral body such as the UN or China to sponsor any future dialogue between Kabul and the Taliban.

However too much of the military's Afghan policy is made through an Indian lens - in the desire to keep Indian influence out of Afghanistan. Unless that changes and Pakistan helps the peace process on its own terms a catastrophic meltdown in Afghanistan would first affect Pakistan.

Image copyright AFP/getty Image caption India has shelled civilians in Pakistan-administered Kashmir

The second group of militants, such as Lashkar-e-Tayaba and Jaish-e-Mohammed, are based in Punjab province and dedicated to attacking India. By their actions they have the capacity to hold Pakistan hostage to Indian military and economic retaliation.

Their role becomes more dangerous due to India's aggressive shelling of civilians in Pakistan-controlled Kashmir and Delhi's declared support to Baloch separatists.

India's actions have convinced many Pakistanis that it is trying to undermine and surround Pakistan with hostile forces. The two countries need to de-escalate tensions on the border and enter into a long term dialogue between their respective spy agencies on how to curb covert interference in each other's state.

On the Pakistani side a long-term policy reassessment towards India is needed by both the army and the government.

Hopeful signs are that General Bajwa knows the Kashmir conundrum well, having served there many years, and much earlier while on duty with UN troops in the Congo he served alongside a former Indian army chief General Bikram Singh.

Ahmed Rashid