Islamabad: The quiet involvement of Pakistan's powerful military in its foreign policy this year paved the way for reviving a stalled dialogue with India, officials said, a thaw leading to the first visit to Pakistan by an Indian premier in almost 12 years.
Prime Minister Narendra Modi's surprise trip to meet Pakistani premier Nawaz Sharif on Friday raised hopes that stop-and-start negotiations between the nuclear-armed neighbours might finally mean progress after more than 65 years of hostility.
Aides say the meeting was arranged directly between the two prime ministers on just a few hours' notice when Modi called to wish 66-year-old Sharif a happy birthday.
But even before Modi arrived in Lahore, relations between the nuclear-armed rivals had begun to thaw, with a resumption of dialogue already in the offing.
On Friday, Modi and Sharif agreed that their foreign secretaries would meet in mid-January to restart talks.
Pakistani officials say "ownership" of peace talks by the military and the appointment of a recently retired general as the national security adviser have given Pakistan renewed confidence to restart dialogue with India, including speaking about the thorny issue of terrorism.
"This round is different because there is backing from the top where it matters ... the army chief is himself on board," a top diplomat said before the visit.
Army chief Gen Raheel Sharif is said to be close to the new national security adviser, recently retired general Naseer Khan Janjua, who in October replaced civilian Sartaj Aziz, an ally of the prime minister.
Many saw the move as strengthening the army's hand in talks with India, with the military remaining wary of a civilian government giving too much away.
"General Janjua has immense experience in these matters. He's the best man for the job and he has already proven to be an asset to this (peace) process," one member of Nawaz Sharif’s cabinet said earlier in December.
"It's only an added benefit that he has a direct line to the (army) chief," he added.
A senior Indian official in New Delhi also said military backing for peace talks marked a major change, with Janjua's involvement as national security advisor a key sign that Gen. Sharif supports resuming the dialogue.
Direct contact between the two prime ministers is a major factor in thawing relations - they met on the sidelines of the Paris climate change summit last month. However Pakistani officials said that true change only became possible after Janjua's appointment.
Earlier this month, the national security advisers of both countries met in Bangkok, paving the way for Indian Foreign Minister Sushma Swaraj's visit to Pakistan for the Heart of Asia summit where she agreed to reopen dialogue with Pakistan, thereby resuming a process broken off since 2012.
Previous attempts to resume talks have been postponed time after time, mostly due to the Indian government's insistence that the focus of discussion must be, first and foremost, about terrorism. India accuses Pakistan-based militants for masterminding the 2008 Mumbai attacks that left 166 dead.
By contrast, Pakistan says the disputed territory of Kashmir is the paramount topic.
With a military man having a greater say in the process, there is more confidence about discussing such sensitive topics, several officials said.
"I think in the past there was a hesitation from Pakistan, understandably, to talk about terrorism [with India] but that may have changed," the diplomat told Reuters.
"There is better division of labour. The real decision-making is happening behind the scenes. The rest is just optics."
Pakistani officials and western diplomats in Islamabad said US officials also worked hard to convince army chief Sharif during his visit to Washington last month to support going back to the negotiating table.
"India came up a lot during the army chief's visit to Washington, definitely with the Secretary of State [John Kerry] and also others," a western diplomat said.
A second member of Sharif’s cabinet said the same of Modi.
"Our understanding is that when Modi was in the United States, he was encouraged very strongly by Obama to rethink his approach toward Pakistan," the minister said.
A close aide to Modi in India said US officials always push for reviving India-Pakistan talks and external pressure was not a factor.
"Modi-ji's visit to Pakistan was not dictated by America but it was planned to keep the national and regional interest in mind," the aide said, using a Hindi term of respect for the premier.
While Pakistan's army may have changed its thinking on talks, even the landmark Modi visit or support from influential facilitators does not guarantee success in a fraught peace process where all sides remain deeply suspicious.
A senior security official close to the talks process was wary when responding to the Modi visit.
"It is a positive step that he came ... definitely ... but we still have to move with caution," he said. "It's a new Modi in an old bottle; Nawaz Sharif should take it one sip at a time."