Pakistan's nuclear armed military is set to get a new supremo later this month when General Qamar Javed Bajwa's tenure as Chief of Army Staff comes to an end.
The military is the most powerful institution in a nation seldom far from its next crisis and the appointment could have a crucial bearing on the future of Pakistan's fragile democracy, and whether relations with neighbouring India are allowed to improve.
During the 75 years since independence and formation of Pakistan out of the Partition of India, the army has seized power three times and directly ruled the Islamic republic for more than three decades, fighting three wars with India along the way.
Even when a civilian government holds power, Pakistan's generals retain a dominant influence over security matters and foreign affairs. And the new chief could set the tone for the conduct of relations with the Hindu nationalist government in India, the Taliban in Afghanistan, and determine whether Pakistan tilts more toward China or the United States.
Appointed chief in 2016, Bajwa sought to balance ties with China and the United States. While Islamabad moved closer to Beijing, Bajwa also worked to thaw relations with Washington, with whom he worked closely during the evacuation of Kabul in 2021 when western forces pulled out of Afghanistan.
Bajwa also took an active interest in economic matters, as well he might given how much of the budget goes to the military.
He made highly-publicised visits to Beijing and the Middle East - helping to secure financial assistance for Pakistan. He also lobbied Washington to help strike a deal with the International Monetary Fund.
He even summoned Pakistan's top industrialists to a meeting at army headquarters to encourage them to pay more tax.
During his tenure, India and Pakistan fought air skirmishes in 2019, but he was a public proponent of better ties and avoided escalation when tensions ran high, such as when an Indian missile accidentally crashed into Pakistan's territory this year.
In early 2021, Bajwa sanctioned a restoration of a ceasefire agreement with Delhi in the disputed region of Kashmir.
Domestically, he was accused of political meddling. Politicians said he helped former cricketer Imran Khan become prime minister in 2018. In an about-turn earlier this year, Khan accused Bajwa of playing a part in his downfall.
HOW IS A CHIEF APPOINTED?
The outgoing chief will give the prime minister a list of senior-most generals to choose from. Only on rare occasions has the baton been passed to someone outside the top four most senior officers in an army that, with just under a million personnel in 2019, was the sixth largest in the world.
An army chief's tenure is for three years, but they often obtain extensions, as did Bajwa. Despite assurances by the military that Bajwa will retire this time, there has been speculation that he could be given another extension due to the latest political and economic ructions in Pakistan.
The generals regarded as front-runners to replace Bajwa are Lieutenant-Generals Asim Munir, the army's quartermaster general and a former spy chief, Sahir Shamshad, commander of the Rawalpindi Corps, Azhar Abbas, the army's chief of general staff, and Nauman Mahmood, chief of the National Defence University.
WHY IT MATTERS GLOBALLY
Pakistan's army chief will play a key role in managing risks of conflict with nuclear-armed rival India on its eastern border, while dealing with potential instability and friction with Afghanistan on its western frontier.
Many world capitals, including Washington and Beijing, have direct ties with Pakistan's military, given the country's strategic location in a volatile neighbourhood, and a coastline close to major shipping lanes serving the oil-rich Gulf.
Foreign governments have periodically questioned the safety of a nuclear arsenal, that includes long-range missiles, in a country so frequently needing IMF bail outs and where anti-Western and anti-India militant groups have proliferated.
And internal security has been a near constant problem due to insurgencies in ethnic Pashtun and Baloch regions.
Despite all the risks, Pakistan and its military have dismissed foreigners' concerns over the command and control, and security of its nuclear weapons.
WHY IS THIS APPOINTMENT IMPORTANT DOMESTICALLY?
The military has long been accused of manipulating the democratic process to maintain its dominance. Nineteen of Pakistan's 30 prime ministers were elected, but not one of them completed their five year terms.
Having recently admitted to its past meddling in politics, the army has said it would no longer interfere. Whether the new chief stands by that commitment could be key to Pakistan's democratic evolution.
Pakistan is in the midst of another bout of political uncertainty as Khan has led country-wide protests in an attempt to force Prime Minister Shehbaz Sharif into early elections.
The incoming army chief could potentially play a key role in lowering the political temperature as Pakistan attempts to survive an economic crisis and recover from historic floods.