Pakistan prime minister Imran Khan signed off on a new head of the Inter-Services Intelligence (ISI) spy agency, the military said on Tuesday, after weeks of delay as regional players try to stabilise the security and economy of neighbouring Afghanistan.
Lieutenant General Nadeem Anjum was approved as ISI head after a final consultation between army chief General Qamar Javed Bajwa and Khan.
The announcement followed weeks of speculation that the delay signified a rift between civil and military powers, speculation that officials denied.
The head of the ISI is one of the most important posts in Pakistan, at the intersection of domestic politics, the war on militancy and Pakistan's foreign relations.
The appointment comes as Afghanistan faces the risk of economic collapse and a potential resurgence in militancy by groups such as Islamic State after the Taliban took control in August.
Pakistan authorities, including the ISI, have long been accused of having links with senior Taliban members and offering them safe haven, charges vehemently denied by Islamabad.
In recent months, the current ISI chief has made two known trips to Kabul to meet Taliban officials, one of them this month with the country's foreign minister.
Anjum's appointment signals a possible smoothing of relations with the military, whose chief had pushed for the shuffle in key personnel.
Anjum, a three-star general with previous postings in Punjab and the southwestern province of Balochistan, begins the new job on 20 November, according to a military statement.
The military had previously said that outgoing ISI chief Faiz Hameed would be posted to the northwestern city of Peshawar, not far from the Afghan border, as corps commander.