The carefully staged “surprise diplomacy” by Indian prime minister Narendra Modi and his warm reception by his Pakistani counterpart Nawaz Sharif break a logjam in bilateral relations.

Modi’s short visit to Lahore on Dec. 25 was welcomed by almost all the mainstream political parties in Pakistan. That betrays a consensus within the political elites there, unlike in India where the opposition parties are playing politics over bilateral diplomacy. The truth is that it was Modi who took the initiative, even if driven by the need for good optics. Former prime minister Manmohan Singh, for all his goodwill, could not take the decision to visit Pakistan.

Pakistan’s foreign policy, however, is not the sole domain of its civilian governments. They have to take the security establishment on board. No one knows this better than Sharif. Given this home truth, the diplomatic efforts are not likely to proceed without a nod from the powerful military. The key to this is largely related to Afghanistan.

In sync with the US and other Western powers as well as China, Pakistan is engaged in a tough effort to help facilitate a settlement between the Afghan Taliban and the Ashraf Ghani administration. The process has been far from smooth. It broke down many times. Infighting within the Afghan Taliban also impinges upon the peace efforts.

It is not a coincidence that Modi stopped over in Pakistan after visiting Kabul, where he inaugurated the Afghan parliament building funded by the Indian government. Modi gave a strong speech on nurseries of terror, reassuring that India will bolster the Afghan defensive capabilities, particularly its air power. Earlier in December, Pakistan invited India to the Heart of Asia conference, and there seems to be a tacit acknowledgement that India cannot be altogether diminished from Afghan affairs.

Pakistan’s security policy has been driven by the fear of Indian influence in Afghanistan for decades. This has landed the country into great difficulty as the proxies to counter that influence have had disastrous consequences for both the state and society. There is now a shift, albeit partial, underway.

Pakistan has been fighting the Pakistani branch of Taliban and their affiliates. The US, China, and Russia have supported these efforts, and it is clear to Pakistan’s strategic community that counterterrorism cannot be effective if militancy is not tackled holistically. But that cannot happen until the Indo-Pak conflict is managed to some degree.

What are Pakistan’s expectations from the peace process?

First, Pakistan needs stability on the eastern borders to concentrate on Afghanistan. The future of Afghanistan is inextricably linked to that of Pakistan. With Daesh (ISIL) and the Pakistani Taliban leadership in Afghanistan, an unstable Afghanistan would hit Pakistan first before any other country in the region.

Second, Pakistan intends to focus on multiple high-cost regional economic projects, including the Pak-China economic corridor. Implementation of these projects requires that regional terrorism is brought to a minimum level. China intends to fast track the corridor, and does not want India-Pakistan tensions to flare up, hence the apparent shift in the military’s calculus. Managing conflict with India is becoming a necessity.

Third, Islamabad’s intelligence apparatus alleges that India supports violent militias in Pakistan, including the insurgents in Balochistan. While the evidence on this is yet to be made public, a thaw with India could be beneficial in reducing conflict by proxy fears.

Fourth, no Pakistan government can actually advance the bilateral peace agenda if the Jammu and Kashmir issue is not on the table. This is a binding constraint. Thus far, the Modi government has shown flexibility as the last joint statement issued by the national security advisors includes this issue. A tangible outcome of the peace process could be back-channel parleys that were suspended eight years ago.

Fifth, a powerful section of business lobbies, and almost all the political parties, want to open trade and issue the much delayed non-discriminatory market access status to India. Other than the assent of the military, there are pending issues with non-tariff barriers from the Indian side, which need to be resolved at the earliest.

Sixth, it cannot be overstated that Pakistan speeding up Mumbai trials will serve the ends of justice, and usher in goodwill within India. Progress on Samjhauta Express case would help cement this thaw more so in the public perceptions within Pakistan.

Seventh, tangible success of renewed India-Pakistan dialogue process would result in pulling back of troops from long borders and the Line of Control. If India reduces its military presence in the disputed region of Kashmir, it will signal the country’s political willingness to engage Pakistan for result-oriented negotiations.

Finally, military and nuclear confidence building measures, for exercising restraint and showing greater transparency will build much-needed trust. Engagement between both militaries needs to be frequent and its scope broadened, with a possible meeting of both military chiefs to discuss peace and stability along the borders.

We welcome your comments at ideas.india@qz.com.